How to convert time format
Hi all,
I had query some time information from the database and use a dataset to bind to a GridView.
But unfortunately, the time that display on the GridView is not my desired choice.
It was display as "3/1/2007 10:06:27 PM".
Does anyone know how to convert it as "3/1/2007 22:06:27"?
Part of my code is as follow
pgDataAdapter.Fill(ds,
"Start Time");
Thanks
Hi bslim67,
You can use the DataFormatString property of the GridView column to format the datetime value.
Hope this helps.
Hi,
Hi,
I had tried this.
<asp:BoundFieldDataField="starttime"dataformatstring="{0:dd/MMM/yy}"HeaderText
="Start Time"ReadOnly="True"SortExpression="starttime"/>But when I run the program during runtime, it seems that it did not take effect.
It still show me the date and time though my dataformat is only on date.
Please help.
Thanks
Dear , friend:
You should set HtmlEncode=false in the markup of:BoundField
I hope the above information will be helpful. If you have any issues or concerns, please let me know. It's my pleasure to be of assistance
Hi,
Thanks for your info. It's really a great help for me.
Labels: ado, bind, convert, database, dataset, display, format, gridview, net, query, time, unfortunately
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home