By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,184 Members | 1,369 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,184 IT Pros & Developers. It's quick & easy.

Formatting gridview column: mm/dd/yy

P: n/a
What is the formatstring for mm/dd/yy (gridview column)? I always want it
to be 6 digits. Thanks.
Nov 13 '08 #1
Share this Question
Share on Google+
7 Replies


P: n/a
"Bobby Edward" <bo***@nobody.comwrote in message
news:OS**************@TK2MSFTNGP03.phx.gbl...
What is the formatstring for mm/dd/yy (gridview column)? I always want it
to be 6 digits. Thanks.
I'm slightly confused because the format string for mm/dd/yy is "mm/dd/yy",
so I presume that this isn't actually what you mean - please clarify...

Also, be aware that not only is the above format not Y2k compatible, it's
also completely ambiguous depending where you are in the world...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 13 '08 #2

P: n/a
you may convert the column into a template field and format de bind...

<asp:label (...) text='<%# format(Eval("Date"),"MM/dd/yy")%>' />

probably there are better ways to do this... but it still works...
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netescreveu na mensagem
news:O%****************@TK2MSFTNGP02.phx.gbl...
"Bobby Edward" <bo***@nobody.comwrote in message
news:OS**************@TK2MSFTNGP03.phx.gbl...
>What is the formatstring for mm/dd/yy (gridview column)? I always want
it to be 6 digits. Thanks.

I'm slightly confused because the format string for mm/dd/yy is
"mm/dd/yy", so I presume that this isn't actually what you mean - please
clarify...

Also, be aware that not only is the above format not Y2k compatible, it's
also completely ambiguous depending where you are in the world...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 13 '08 #3

P: n/a
string temp = DateTime. Today.ToString("MM/dd/yy",
DateTimeFormatInfo.InvariantInfo);

"Christiano Donke" <cd****@digiexpress.com.brдϢ
news:#r**************@TK2MSFTNGP03.phx.gbl...
you may convert the column into a template field and format de bind...

<asp:label (...) text='<%# format(Eval("Date"),"MM/dd/yy")%>' />

probably there are better ways to do this... but it still works...
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netescreveu na mensagem
news:O%****************@TK2MSFTNGP02.phx.gbl...
>"Bobby Edward" <bo***@nobody.comwrote in message
news:OS**************@TK2MSFTNGP03.phx.gbl...
>>What is the formatstring for mm/dd/yy (gridview column)? I always want
it to be 6 digits. Thanks.

I'm slightly confused because the format string for mm/dd/yy is
"mm/dd/yy", so I presume that this isn't actually what you mean - please
clarify...

Also, be aware that not only is the above format not Y2k compatible, it's
also completely ambiguous depending where you are in the world...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 14 '08 #4

P: n/a
"Spider" <Ne*********@21cn.comwrote in message
news:e3**************@TK2MSFTNGP04.phx.gbl...
>>Also, be aware that not only is the above format not Y2k compatible,
it's also completely ambiguous depending where you are in the world...

you may convert the column into a template field and format de bind...

<asp:label (...) text='<%# format(Eval("Date"),"MM/dd/yy")%>' />

probably there are better ways to do this... but it still works...
>>you may convert the column into a template field and format de bind...

<asp:label (...) text='<%# format(Eval("Date"),"MM/dd/yy")%>' />

probably there are better ways to do this... but it still works...

string temp = DateTime. Today.ToString("MM/dd/yy",
DateTimeFormatInfo.InvariantInfo);
Which would result in a string like "02/03/04". Apart from not being Y2k
compliant, this is *completely* ambiguous.

http://en.wikipedia.org/wiki/Image:Date.png

In the US and some parts of Canada, Kenya and the Philippines, that date
would be interpreted as 3 February 2004.

In China and some European territories, it would be interpreted as 4 March
2002.

In most of the rest of the world, it would be interpreted as 2 March 2004.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 14 '08 #5

P: n/a
In the US and some parts of Canada, Kenya and the Philippines, that date
would be interpreted as 3 February 2004.
True. But this website is for US people only. ;)
Nov 14 '08 #6

P: n/a
"Bobby Edward" <bo***@nobody.comwrote in message
news:Oi**************@TK2MSFTNGP02.phx.gbl...
>In the US and some parts of Canada, Kenya and the Philippines, that date
would be interpreted as 3 February 2004.
True. But this website is for US people only. ;)
And US people aren't interested in Y2k compliance - fair enough...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 14 '08 #7

P: n/a
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>
And US people aren't interested in Y2k compliance - fair enough...
LOL good one! ;)

The dates will be only from 2008 forward. It's ok. Thanks. :)
Nov 15 '08 #8

This discussion thread is closed

Replies have been disabled for this discussion.