 |
| VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1).
** Please don't post code questions here **
For issues specific to a particular language in .NET, please see the other forum categories. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

November 17th, 2003, 04:35 PM
|
|
Friend of Wrox
|
|
Join Date: Sep 2003
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Formatting datagrid column dates
I have a bound datagrid ( bound to a dataview ). One of the
fields is a datetime field. I wish to format the date display
of this bound datetime column. Instead of showing
dd/mm/yyy hh:mm:ss - I wish to show just dd/mm/yyyy.
Do I use a column style to format the date?
If so how? Can anyone point me to examples
of formatting bound datagrid columns ?
Thanks.
|
|

November 18th, 2003, 05:07 AM
|
|
Friend of Wrox
|
|
Join Date: Sep 2003
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Sorry dont quite understand.
Is the dataformatstring under datagrid.columns.?
I cant find any examples at MS.
How do I set the formatstring on my grid column?
|
|

November 18th, 2003, 01:18 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
<asp:BoundColumn ... DataFormatString="dd:MM:yyyy"></asp:boundcolumn>
Peter
------------------------------------------------------
Work smarter, not harder.
|
|

November 19th, 2003, 08:13 AM
|
|
Friend of Wrox
|
|
Join Date: Sep 2003
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks Peter
I didn't realise I could edit the HTML directly
and place formatting code in there (still learnin').
|
|

August 7th, 2004, 04:35 PM
|
|
Authorized User
|
|
Join Date: Aug 2004
Posts: 86
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi-
I needed the same thing and tried the format, but it displays "dd:mm:yyyy" instead of the real value. What I am doing wrong here? Your response will be greatly appreciated.
Thanks
Renu
Quote:
quote:Originally posted by planoie
<asp:BoundColumn ... DataFormatString="dd:MM:yyyy"></asp:boundcolumn>
Peter
------------------------------------------------------
Work smarter, not harder.
|
|
|

August 9th, 2004, 12:35 PM
|
|
Authorized User
|
|
Join Date: May 2004
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
change the date into a string before you put it into dataview :D
|
|

January 5th, 2005, 03:10 AM
|
|
Registered User
|
|
Join Date: Jan 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Try DataFormatString="{0:dd-mm-yyyy}"
hope this helps
Quote:
quote:Originally posted by Renu
Hi-
I needed the same thing and tried the format, but it displays "dd:mm:yyyy" instead of the real value. What I am doing wrong here? Your response will be greatly appreciated.
Thanks
Renu
Quote:
quote:Originally posted by planoie
<asp:BoundColumn ... DataFormatString="dd:MM:yyyy"></asp:boundcolumn>
Peter
------------------------------------------------------
Work smarter, not harder.
|
|
love never fails
|
|

January 5th, 2005, 05:13 AM
|
|
Friend of Wrox
|
|
Join Date: Dec 2004
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
<asp:BoundColumn DataField=startDate HeaderText="startDate" DataFormatString="{0:dd-MMM-yyyy HH:mm:ss}">
</asp:BoundColumn>
Hope this code snippet helps!
Best Regards
Vadivel
MVP ASP/ASP.NET
http://vadivel.thinkingms.com
|
|

February 4th, 2005, 11:37 AM
|
|
Registered User
|
|
Join Date: Feb 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
For short date use the following DataFormatString:
{0:d}
|
|
 |