Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 International Dates vs USA Dates

Author  Topic 

Scott
Posting Yak Master

145 Posts

Posted - 2002-02-22 : 04:50:20
All solutions to this that I have read about have some nifty little function, ISO date formats, dd-MMM-yyyy etc...
I use the following (so far seems to work perfectly 6 months):

Prefix every INSERT or UPDATE statement involving dates with:
SET DATEFORMAT dmy INSERT INTO...
SET DATEFORMAT dmy UPDATE...
This works perfectly for dates like 25/12/02 or 22/2/2002…

No one seems to offer this solution, is there a problem with it?




Edited by - scott on 02/22/2002 04:56:48

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-02-22 : 06:50:04
The problem is when you have a mix of date formats and/or a number of different locales. If you run a site in the U.S. that accepts flight reservations, for example, and Europeans also submit data, you'll need to support both DMY and MDY formats. How about a Brit who is in the U.S. and wants to fly home? Which format will he/she use to enter departure date? And the biggest problem are the early days of the month (1-12), because either format will generate valid date values, but they could be the wrong date! And you'll notice numerous sites use drop down boxes for month, day, and year, and not rely on manual date entry, just to avoid this issue.

This is the reason the ISO yyyymmdd format was created; it's unambiguous. There's a secondary benefit too, this format will sort character date values properly.

Go to Top of Page
   

- Advertisement -