all groups > sql server clients > april 2004 >
You're in the

sql server clients

group:

set date format?


set date format? Janus Knudsen
4/26/2004 2:06:05 AM
sql server clients:
Hello..
As I remember I ran across a set statement that could control the dataformat on the server

For instance
print cast(getdate as varchar) it returns current date and time in am/pm format, but in Denmark we're not using this format, we're using 24hour format. Obviously I could use CONVERT, but that's not an option in the current scenario
The print output should be in 24hour forma

So if anybody can remember that... :O

Kind regard
Janus, Denmar
Re: set date format? John Bell
4/26/2004 3:26:33 PM
Hi

Setting the default language with sp_configure will give a default date
format, but that can be overridden with SET LANGUAGE or SET DATEFORMAT (for
input) on the connection.

John


[quoted text, click to view]
format, but in Denmark we're not using this format, we're using 24hour
format. Obviously I could use CONVERT, but that's not an option in the
current scenario!
[quoted text, click to view]

Re: set date format? Andrew J. Kelly
4/26/2004 8:45:09 PM
The format of how something looks when displayed is a factor of the GUI in
which it is displayed and not a database function. You can choose to use
CONVERT() to force a particular string but that does defeat the ability for
2 different GUI's in to display the data in their local format. The setting
of SET DATEFORMAT is for input only. See here from BOL:

This setting is used only in the interpretation of character strings as they
are converted to date values. It has no effect on the display of date
values.

--
Andrew J. Kelly SQL MVP


[quoted text, click to view]
format, but in Denmark we're not using this format, we're using 24hour
format. Obviously I could use CONVERT, but that's not an option in the
current scenario!
[quoted text, click to view]

AddThis Social Bookmark Button