Groups | Blog | Home
all groups > asp.net > may 2004 >

asp.net : Formatting a date in a datagrid



Matt Berther
5/1/2004 9:53:16 PM
Hello William,

<asp:BoundColumn DataField="myField" DataFormatString="{0:D}" />

[quoted text, click to view]

--
Matt Berther
William Gower
5/1/2004 11:29:51 PM
I have a datagrid that has a column that displays a date. The date is
currently being displayed in a long format, I want to format it to display
in short format. How do I do that in a datagrid?

Rick Spiewak
5/2/2004 12:37:20 AM
Go to the Property Builder (right-click on the datagrid for the context
menu). Assign a column to the date field if you haven't already (don't
autogenerate columns). Pick that column, and assign a format of "{0:d}" to
it.

[quoted text, click to view]

William Gower
5/2/2004 1:03:09 AM
Thanks that got me half way there. It shows now Sunday January 3, 2004. I
want it to show 01/03/2004

[quoted text, click to view]

Jos
5/2/2004 9:16:10 AM
[quoted text, click to view]

Use a lowercase d instead of uppercase.

--

Jos

Ashish M Bhonkiya
5/2/2004 2:27:23 PM
Hi
[quoted text, click to view]

use the DataFormatString = "{0:MM/dd/yyyy}"

HTH
Regards
Ashish M Bhonkiya

[quoted text, click to view]

AddThis Social Bookmark Button