• SQLServer stores the DateTime in an 8-byte field. The first four bytes are the number of days since 1/1/1900. The other 4 bytes represent some fraction of a second past midnight. This is an implementation choice, it is not a defined interface.

    Try this:

    Select Cast(getdate() As Binary(8))

    You'll get something like:

    0x00009D6500A63B12

    The "date" part here is x0009D65, or 40,293. When you add '1' to a date, you are adding one to the date part of the 8-byte value:

    Select Cast(getdate() + 1 As Binary(8))

    0x00009D6600A6C675

    I think the reason behind the answer is that SQLServer tries its best to guess at what you mean.

    If you have an integer, it treats it as the number of days past 1/1/1900. This is also consitent with something like:

    SELECT Getdate() + 1

    If negative, it's the number of days before 1/1/1900:

    Select Cast(-10 As DateTime) - Dec 22, 1899.

    If you pass in a string to CAST, it tries to make sense of the string:

    Select Cast('1/23/1945' As DateTime) - what you would expect (at least in the US).

    Select Cast('10:32' As DateTime) - 10:32 am on 1/1/1900

    Select Cast('4/27/10' As DateTime) - 4/27/2010!

    Select Cast('4 april 2010' As DateTime) - perfectly valid.

    try these:

    Select Cast(1-1-1900 As DateTime)

    Select Cast(1/1/1900 As DateTime)

    Select Cast(01/01/01 As DateTime)

    Select Cast(01/01/00 As DateTime)

    Hint: They are not date strings. They are arithmetic operations!

    http://www.sql-server-performance.com/articles/dev/datetime_datatype_p1.aspx