Date format in datagrid
(Friday, September 03, 2004)
Found the following interesting discussion in the Newsgroups:
Date format in datagrid by:Niclas Lindblom
| Hi,
I have a bound column in a datagrid. The value in the database is using the SQL datetime format which gives both date and time. How do I configure the datagrid cell to only display the date in the format DD/MM/YYYY ? I have tried
colDateCompleted.DataFormatString = "{0:d}"
but this still displays the whole date including the time.
Any help appreciated
Regards
Niclas
| | | Reply: by:Ken Tucker [MVP]
| | | Hi,
You have to add a tablestyle to your grid.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchformattingwindowsformsdatagridvisualbasicprimer.asp
Ken
|
Posted by Xander Zelders

|
|
|
|
2 Comments:
Use {0:dd/MM/yyyy}
Best Regards
Use this "{0:MM/dd/yyyy}" as well as HtmlEncode="false" then you will be able to see the formatted string.
Post a Comment
<< Home