Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

British/American Date Fromat 1

Status
Not open for further replies.

mattyboy2000

Programmer
Jul 31, 2002
129
GB
I am currently experiencing a problem with date formats.

I am in Britain and when I run my programs it sees dates in the American format i.e. MMDDYYYY rather than DDMMYYYY. I have checked the system setup on my PC and it is set to UK.

I am pulling a date from a database and because of the different format it is interpereted incorrectly.

Does anyone have any idea what this problem could be, and could it have something to do with Windows XP professional?

Matt
 
Hello Matt,
This is a quite common problem taht you are mentioning.

One way around (and a permenent fix) is to format the dates using the universal date format. This will ensure that the data will be stored/displayed and represented correctlly no matter what date settings the user is using. See the example below:

Code:
Dim dtm As DateTime
dtm = New DateTime(2000, 2, 10)
Debug.WriteLine(dtm.ToString("dd MMM yyyy"))

Hope that this helps
Camel
 
Camel -

A better format is ISO-8601, which has two variants:

The "loose" version is:
yyyy-mm-dd hh:mm:ss

The "strict" version is:
yyyy-mm-ddThh:mm:ssZZZ
where the "T" is a literal, and the "ZZZ" is the timezone information (EST, PST, etc). You can also use a single "Z" on the end to indicate UTC/GMT/Zulu time.

This format is nice because it provides a natural sort order. If you're using a grid control that allows the user to resort by clicking the column headers, this will display correctly.

Chip H.

 
Hello Chiph,
You are absolutely right. The "yyyy-mm-dd hh:mm:ss" is a better format if you want to sort dates but it is quite complicate sometimes for a user to find the important information.
Important information is a "vague" term but let me explain:

If you are displaying the data for, say, the sales of a product in the last 10 years displaying the data as the ISO-8601 is brilliant.
If on the other hand you do that for the sales in a month then the information becomes harder to retrieve for the user (2002-02-01 12:00:43 instead of 01-02-2002 bold indicate the "important information").

You can easily see that a user used to see information on the "traditional" format (dd mm yyyy) have greater difficulty of identifying if the data displayed is 01 Feb 2002 or 02 Jan 2002.

To summarize the ISO-8601 IS the best way to store dates internally (database) but the universal format is the best presentation format, because it eliminates any "misunderstandings".

Camel
 
To summarize the ISO-8601 IS the best way to store dates internally (database) but the universal format is the best presentation format, because it eliminates any "misunderstandings".

I'll have to disagree with you on this point, as misunderstandings are more likely to ocurr, as Americans expect the month first, and (most) Europeans expect the day first. This brings us back to Mattyboy2000's problem of not being able to tell the difference between January 7th and July 1st.

The Japanese are already using ISO-8601, and the Germans are moving that way (meaning the folks in Brussels won't be far behind). It's just a matter of becoming accustomed to a new presentation style.

Also, if you do any work with XML Schema documents (.XSD) files, the xs:datetime datatype is strict ISO-8601.

Chip H.
 
Hello chiph,
I'll have to disagree with you on this point, as misunderstandings are more likely to ocurr, as Americans expect the month first, and (most) Europeans expect the day first. This brings us back to Mattyboy2000's problem of not being able to tell the difference between January 7th and July 1st.

It's my turn to disagree now [upsidedown] i still do not beleve that any person from any country used to any kind of date repesentation can be confused between the two dates 7 January 2002 and 1 July 2002

The specification of the month is as fully textual (e.g. January) is clearer than displaying 01 no mater where in the date is present.

I would also love to hear the opinion of users with different cultures, so if you have something to say dont be affraid leave a message.

Camel
 
If you use only numbers, you can't tell what date is represented by 02/08/2002. Only by using ISO-8601 format, or by replacing the month with the alpha version (which gets you into language problems) can you truly tell.

I think we'll have to agree to disagree. ;-)

Chip H.
 
As a developer with applications working in more than 30 countries, I stick to the dd-MMM-yyyy format as it doesn't confuse US users and it seems to be fine for the rest of the world.

But you are right. If it says 14-May-2005 my users in France might prefer 14-Mai-2005. I guess we are asking the non english speakers to learn the English names for the months. As it's only 12 values that doesn't seem too demanding.

As for 2005-05-14 as a preferred format - it's fine for sorting, but why change to a format no one is familair with?

Editor and Publisher of Crystal Clear
 
ISO-8601 is the preferred date format in Japan.
:)

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top