About Me

My photo
Northglenn, Colorado, United States
I'm primarily a BI Developer on the Microsoft stack. I do sometimes touch upon other Microsoft stacks ( web development, application development, and sql server development).

Monday, November 05, 2007

SQL Server 2008 Date and Time data types

No more converting datetimes and combining datetimes together because you wanted to seperate date and time. (EX: '1/1/1900 11:36AM')

Here are the new data types for SQL Server 2008:

Data typeFormatRangeAccuracy
timehh:mm:ss[.nnnnnnn]00:00:00.0000000 through 23:59:59.9999999100 nanoseconds
dateYYYY-MM-DD00001-01-01 through 9999-12-311 day
smalldatetimeYYYY-MM-DD hh:mm:ss1900-01-01 through 2079-06-061 minute
datetime YYYY-MM-DD hh:mm:ss[.nnn]1753-01-01 through 9999-12-310.333 second
datetime2YYYY-MM-DD hh:mm:ss[.nnnnnnn] 0001-01-01 00:00:00.0000000 through 9999-12-31 23:59:59.9999999100 nanoseconds
datetimeoffsetYYYY-MM-DD hh:mm:ss[.nnnnnnn] [+-]hh:mm00001-01-01 00:00:00.0000000 through 9999-12-31 23:59:59.9999999 (in UTC)100 nanoseconds

Source: http://blogs.msdn.com/usisvde/archive/2007/11/05/get-a-date.aspx

No comments: