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.
Author |
Topic |
collie
Constraint Violating Yak Guru
400 Posts |
Posted - 2010-09-14 : 05:22:11
|
Hi,If a date is stored in the db as 2010-09-19 00:00:00 (yyyy-mm-dd) is it USA? I am confused as to what the zone is of our client.ThanksWhisky-my beloved dog who died suddenly on the 29/06/06-I miss u so much. |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-09-14 : 05:35:43
|
quote: Originally posted by collie Hi,If a date is stored in the db as 2010-09-19 00:00:00 (yyyy-mm-dd) is it USA? I am confused as to what the zone is of our client.ThanksWhisky-my beloved dog who died suddenly on the 29/06/06-I miss u so much.
Do you think USA is a few days in the future?In Germany we have today 2010-09-14  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
collie
Constraint Violating Yak Guru
400 Posts |
Posted - 2010-09-14 : 05:53:21
|
What you mean to tell me USA isn't in the future??? So if date is stored as 2010-09-14 it means it's European and if a date is stored in the db as 2010-14-09 it's USA? From where does the db take its settings?Whisky-my beloved dog who died suddenly on the 29/06/06-I miss u so much. |
 |
|
Kristen
Test
22859 Posts |
Posted - 2010-09-14 : 06:08:32
|
quote: Originally posted by collie If a date is stored in the db as 2010-09-19 00:00:00 (yyyy-mm-dd) is it USA?
A date isn't stored in any given format, its stored in an unambiguous binary representation. ("Number of days since Epoch" type of thing)If you present SQL with a date in a string formatted as "2010-09-19" then, all other things being equal, it will treat it as y-m-d - in particular because the Y part has a century and is too big to be M or D, and the D is bigger than 12 and the M smaller than 12.Irrespective of that 9999-99-99 dates are treated as "y-m-d" by default, but there is nothing to say they have to be.SET DATEFORMAT MYDSELECT CONVERT(Datetime, '01-02-03')gives2002-01-03The current setting for which is D, M and Y is influenced by the Country and language of the current login, and the settings of the server.For output you can format the date how you like ... so if you are seeing some data output from the database it doesn't tell you much, except that the client prefers Y-M-D format and is already enjoying the weekend! |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|
|