-1

I am confused reading statements in "Why is 1899-12-30 the zero date in Access / SQL Server instead of 12/31?"

Was there date type in SQL Server before 2008 version? I cannot find.
In SQL Server 2008 zero date is 0001-01-01. Were there any date type before (in previous SQL Server versions) how is it backward compatible?

Community
  • 1
  • 1

2 Answers2

3

No. Prior to SQL Server 2008, there was only the datetime and smalldatetime types.

Data type...............Range..................................................................Accuracy
datetime..................January 1, 1753, through December 31, 9999.....3.33 milliseconds

smalldatetime..........January 1, 1900, through June 6, 2079............... 1 minute

Please see: Date and Time Data in SQL Server 2008, specifically the bit that says "Date/Time Data Types Introduced in SQL Server 2008"

Mitch Wheat
  • 295,962
  • 43
  • 465
  • 541
1

In SQL Server datetime datatype the minimum date that can be stored is 1 Jan 1753.

However the datetimes are stored as numeric offsets to a base date of 1900-01-01 00:00:00.000

SELECT CAST(-0.25 AS DATETIME) /*1899-12-31 18:00:00.000*/
SELECT CAST(0 AS DATETIME) /*1900-01-01 00:00:00.000*/
SELECT CAST(0.25 AS DATETIME) /*1900-01-01 06:00:00.000*/

1899-12-30 has no significance in SQL Server.

SELECT CAST(CAST('1899-12-30' AS DATETIME) AS FLOAT) /*Returns -2*/
Community
  • 1
  • 1
Martin Smith
  • 438,706
  • 87
  • 741
  • 845