473,503 Members | 7,823 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Formatting gridview column: mm/dd/yy

What is the formatstring for mm/dd/yy (gridview column)? I always want it
to be 6 digits. Thanks.
Nov 13 '08 #1
7 3113
"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
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
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
"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
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
"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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
6208
by: washoetech | last post by:
I have a gridview control. In this grid view there is a column for the price of an item. Some of the prices have a dollar sign in front of it and some dont. How do I get rid of the dollar sign...
5
1553
by: Shimon Sim | last post by:
I just don't understand what is wrong. I have simple query. One of the returning fields is data I created bound column for GridView (ASP.NET 2.0) and specified DataFormatString as {0:d} - it...
1
4561
by: euan | last post by:
HI Guys, I have bee using conditional formatting in the datagrid recently and I am moving over to framework 2.0 and noticed the datagrid has been replaced by the gridview. So, I would like to do...
4
2606
by: Nalaka | last post by:
Hi, I have two questions about gridViews. 1. How can I intercept the row/column values at loading to change values? 2. After I update a row (using default update functionality), how can I...
3
2082
by: Simon Harvey | last post by:
Hi all, I'm having problems getting my date to format. Someone told me that with the GridView, you need to use a TemplateColumn and not a BoundColumn when displaying dates. Given that, can...
2
2688
by: J055 | last post by:
Hi I've been looking into different ways of formatting columns/rows in the GridView control. I realize now, I think, that once the datasource is bound to the control the original column type...
3
2378
by: CSharpguy | last post by:
I'm trying to format the GridView on my web form and its not working. for money I have {0:C} and for date fields, I have {0:d} and the format isn't changing, what else do I need to do to get the...
4
8312
by: Ken Wigle | last post by:
All, I would be very grateful for any help on this question. I have an application in asp.net 2.0 where I dynamically create a datatable and then bind that to a gridview. Unfortunately, the...
1
1865
by: AmitKu | last post by:
I've got the Gridview going at full speed, and I've enabled editing, but when I click on the "edit" button, this ugly editing UI comes up. Well it's not ugly, but it's not great either. How do I...
2
2075
by: pgonzo | last post by:
In my initial tests with the GridView control, I cannot understand why the DataFormatString attribute has no affect on the column formatting. The 'creation_date' field is being reported as "3/30/02...
0
7193
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7067
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7264
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6975
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4992
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
371
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.