Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

Date Format

I want my date to be displayed like this.
2003/08/04 15:08:12 JST
How to do it.?. I dont want to get each item individually and concatenate it. Is there any other way of doing it using CultureInfo class

SK
Friday, August 06, 2004

What you're describing is:

Short date pattern +
Long time pattern +
Textual Timezone

The problem is the Textual Timezone information. That's not one of the available fields. If you were happy with offsets:

2003/08/04 15:08:12 +01:00

Then you could do that using:

Console.WriteLine(DateTime.Now.ToString("%G zzz"));

Brad Wilson (dotnetguy.techieswithcats.com)
Friday, August 06, 2004

Look into the DateTimeFormatInfo class - it allows you to apply custom formatting patterns, and have dates formatted as specified be recognized as valid dates.

Greg Hurlman
Friday, August 06, 2004

date.ToString(something)

ms-help://MS.VSCC.2003/MS.MSDNQTR.2004APR.1033/cpref/html/frlrfsystemdatetimeclasstostringtopic3.htm

ms-help://MS.VSCC.2003/MS.MSDNQTR.2004APR.1033/cpref/html/frlrfsystemglobalizationdatetimeformatinfoclasstopic.htm

don't know if you can get the name of the timezone from that however, but +8/+08/+08:00 (or whatever JST is) is easy.

mb
Friday, August 06, 2004

To Wizards:

As for the topic of choosing what Date Format should I use for your project, I have an alternative way of providing the user with 48 to 60 date formats to choose from - and there is a wide assortment to choose from.

I have put together a package that will do just that and do more.  If interested, go to http://www.thadware.com
Even though I am still adding a few things here and there.

Thad
Saturday, August 21, 2004

*  Recent Topics

*  Fog Creek Home