Home All Groups Group Topic Archive Search About
Author
29 Jul 2005 4:20 PM
MAF
Is there anyway to get the system dateformat?  What I am trying to do is get
the dateformat, set it to a know format so I can run my script and reset it
back to the original format.

Psuedo code

DECLARE @OrgFormat nvarchar(30)
set OrgFormat = ??
SET DATEFORMAT "mdy"
--Do something
set DateFormat OrgFormat

Author
29 Jul 2005 4:35 PM
Aaron Bertrand [SQL Server MVP]
Why don't you use a standard, non-ambiguous date format all of the time?
e.g. YYYYMMDD can be produced easily using CONVERT(CHAR(8), GETDATE(), 112)

You can dump DBCC USEROPTIONS into a temp table, and then see if LANGUAGE or
DATEFORMAT have been set explicitly for the current user.  But I really
think it's safer to just use a language-neutral and dateformat-neutral
format in the first place.


Show quote
"MAF" <mfra***@henwoodenergy.com> wrote in message
news:e%23DYrlFlFHA.3968@tk2msftngp13.phx.gbl...
> Is there anyway to get the system dateformat?  What I am trying to do is
> get the dateformat, set it to a know format so I can run my script and
> reset it back to the original format.
>
> Psuedo code
>
> DECLARE @OrgFormat nvarchar(30)
> set OrgFormat = ??
> SET DATEFORMAT "mdy"
> --Do something
> set DateFormat OrgFormat
>
>

AddThis Social Bookmark Button