Home All Groups Group Topic Archive Search About

dataformatstring for dates in datagrid

Author
3 Jun 2005 10:42 PM
Chumley Walrus
I want to show just the time of day for my date object in sql dbase on
a datagrid:

DataFormatString="{0:s}" will display "2005-06-01T12:32:00" if my date
object in the dbase is configured for full date and time. How would I
parse just the 12:32:00 from that in the DataFormatString=
configuratin for the datagrid?
thanks
chumley

Author
4 Jun 2005 8:23 AM
Teemu Keiski
Hi,

{0:dd.MM.yyyy} would return 04.06.2005 (date)

{0:HH:mm:ss} would return 11:21.22 (time)

So in short:

dd - days
MM - months
yyyy - year

HH - hours
mm - minutes
ss - seconds

Of course there are also variations so of these. You find exact description
in documentation.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vafmtuserdefineddateformats.asp

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU