Format of date changes

  • Hi,

    We loaded date data into our sql server in the format 'YYYY-MM-DD'. eg '2000-12-01'. Performing select month(fieldname) immediately afterwards would correctly give us 12 and Day(fieldname) would give us 01, as expected.

    Sometime in the last day or so this has flipped over!

    Now if we do the month(filedname) we get  01 and Day(fieldname) we get 12

    We are in the UK, if this makes a difference.

    What could have caused this flip, and how do we put it right?

    TIA

    Chris

  • Has anyone changed the server side regional settings overnight?



    Shamless self promotion - read my blog http://sirsql.net

  • Look at the user accounts Language settngs, if British then has to be at the PC itself that it changed, especially if using a custom app.

  • Somebody changed something. Now you have to figure out what it was.

    1. SQL Server collation?

    2. The default language? (as Antares suggested)

    3. You are using a different PC, which has a different regional setting?

    4. The regional setting  of the SQL Server server changed? (as Nicholas Cain suggested)

    -SQLBill

    BTW-Datetime datatype is very misunderstood by a lot of people. SQL Server does not STORE the date and time in the format you input it. It takes the date and time and stores them as the number of days after a default date (1 Jan 1900) and the number of 'ticks' after midnight. That's why SQL Server collation is so important - SQL Server has to understand the format that it is receiving the date/time data. Or SET DATEFORMAT can be used to let SQL Server understand the format.

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

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