Setting date format

  • If I run "select cast('04/18/2005' as datetime)" it returns "2005-04-18" and "select cast('18/04/2005' as datetime)" errors, so SQL Server is set to use the mm/dd/yy date format.

    How can I change the settings for SQL Server so that it uses the dd/mm/yy date format and reads "18/04/2005" as "18 April" ?

    I can't change the T-SQL, so using "SET DATEFORMAT DMY" is not an option. I have checked the regional settings on Control Panel, and they are set to dd/mm/yy date format. Enterprise Manager even uses the dd/mm/yy date format to display dates in dialog boxes.

    Also, is it possible to set he date format for a databases independently on SQL Server's date format ?

    Thanks,

    Craig

  • Check the language setting of the login, it affects the way dates are converted.

    Far away is close at hand in the images of elsewhere.
    Anon.

  • You should get into the habit, using a considered safe date format like SQL Server's style 112 or 126 to avoid such kind of problems.

    See if these help explaining

    http://www.sql-server-performance.com/fk_datetime.asp

    http://www.karaszi.com/SQLServer/info_datetime.asp

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • This is a better explanation of the problem I am having...

    http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=5&messageid=175670

  • Now, this looks completely different now. An interesting, yet important part of your problem you didn't conceal here in this thread, don't you think?

    Sorry, I have no experience with that tool.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply