Date Format
  Home FAQ Contact Sign in
microsoft.public.sqlserver.setup only
 
Advanced search
POPULAR GROUPS

more...

microsoft ... sqlserver.setup Profile…
 Up
Date Format         


Author: Dan Bridgland
Date: Sep 18, 2008 03:45

Hi,

Having just moved many of my databases over to SQL2005 I've just
stumbled across a problem with US and UK date formats. My Stored
procedures are set up for UK date format dd/mm/yy but the new SQL2005
server want to put everything in US format mm/dd/yy

How do I change SQL2005 to use the UK date format?

Regards
Dan
4 Comments
Re: Date Format         


Author: Aaron Bertrand [SQL Server MVP]
Date: Sep 18, 2008 03:52

I strongly suggest changing to passing unambiguous date formats, e.g.
YYYYMMDD.

On 9/18/08 6:45 AM, in article
faf7acf9-d1c6-476b-9d4a-d1b3ef5d99dd@y21g2000hsf.googlegroups.com, "Dan
Bridgland" gmail.com> wrote:
> Hi,
>
> Having just moved many of my databases over to SQL2005 I've just
> stumbled across a problem with US and UK date formats. My Stored
> procedures are set up for UK date format dd/mm/yy but the new SQL2005
> server want to put everything in US format mm/dd/yy
>
> How do I change SQL2005 to use the UK date format?
>
> Regards
> Dan
no comments
Re: Date Format         


Author: Dan Bridgland
Date: Sep 18, 2008 04:05

Thanks for the advice, I see exactly where your coming form there.
How can I set that as the server default, as opposed to the US default
format?

Regards
Dan
Show full article (0.91Kb)
no comments
Re: Date Format         


Author: Tibor Karaszi
Date: Sep 18, 2008 09:15

Are we talking about input or output? Check out http://www.karaszi.com/SQLServer/info_datetime.asp
for elaboration

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi

"Dan Bridgland" gmail.com> wrote in message
news:fcc4d468-07e3-4908-9398-57592982458c@p25g2000hsf.googlegroups.com...
Thanks for the advice, I see exactly where your coming form there.
How can I set that as the server default, as opposed to the US default
format?

Regards
Dan
Show full article (1.27Kb)
no comments
Re: Date Format         


Author: Aaron Bertrand [SQL Server MVP]
Date: Sep 18, 2008 09:44

> Thanks for the advice, I see exactly where your coming form there.
> How can I set that as the server default, as opposed to the US default
> format?

If you are passing a string into a stored procedure parameter that is
DATETIME or SMALLDATETIME, just make sure that the string is passed in as
the correct format. If you continue to use a regional format like m/d/y
there isn't really a good way for SQL Server to know that you meant m/d/y
and not d/m/y. What happens if two different users call the stored
procedure, one using 8/4/2008, and the other 4/8/2008, and they meant the
same date? For one of them, they are going to get the wrong data,
regardless of the regional settings on the machine, or the dateformat /
language settings of the user. You should read Tibor's article
thoroughly...
no comments