0

I am adding rows to a runtime table as following"
dtRecords.Rows.Add("RecordingDate", typeof(DateTime));
the date is stored as long datetime but I want to view the date date only in thos runtime table:
the date appears as following: 0206/2008 12:00:00 am
but I want it to appear as following:0206/2008
i.e,the date with out the time.
does any one has an idea?

thnx in advance

6
Contributors
7
Replies
8
Views
8 Years
Discussion Span
Last Post by amar_interface
0

what type of object is that dtRecords.is it DataTable class's object.then finally u will bind this datatable to gridview or datalist control isn't it.thre u can specify the date format.
set DataFormatString property if it is a boundfield
if it is itemtemplate then give format string as second argument to Eval menthod.
hope this will help...let me wait for ur responce...

0

thnx for ur reply,

dtRecords is a table that I created in runtime and the grid view columns is not specified in the design so I want to specify the datetime format through this.line:
dtRecords.Rows.Add("RecordingDate", typeof(DateTime));
is there any modification to this line to change the datetime format to show date only.
do you understand me.

thnx in advance.

0

thnx for ur reply,

dtRecords is a table that I created in runtime and the grid view columns is not specified in the design so I want to specify the datetime format through this.line:
dtRecords.Rows.Add("RecordingDate", typeof(DateTime));
is there any modification to this line to change the datetime format to show date only.
do you understand me.

thnx in advance.

Web:
http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=181

VB:
http://programming.top54u.com/post/ASP-Net-VB-Format-DateTime-Using-ToString-Function.aspx

0
dtRecords.Rows.Add("RecordingDate", DateTime.Now); // Current Date
dtRecords.Rows.Add("RecordingDate", DateTime.Parse("12/31/2002"));

DataFormatString should be {0:dd/MMM/yyyy}

0

I am adding rows to a runtime table as following"

dtRecords.Rows.Add("RecordingDate", typeof(DateTime));

You can add rows to a DataTable using the following syntax

DataTable.Rows.Add(DataRow) ;
DataTable.Rows.Add(Object[] ) ;

But you are passing two arguments. Are you passing column name in you code ('RecordingDate').


How is it possible?

0

I am adding rows to a runtime table as following"
dtRecords.Rows.Add("RecordingDate", typeof(DateTime));
the date is stored as long datetime but I want to view the date date only in thos runtime table:
the date appears as following: 0206/2008 12:00:00 am
but I want it to appear as following:0206/2008
i.e,the date with out the time.
does any one has an idea?

thnx in advance

hi try to format recordingdate field in date only format for ex.

in query date field is write like convert(datetime,fildname,103) or
convert(nvarchar,fildname,103)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.