New Date Type: is a date type that appears in 2008 that is not in 2005.
1,date data type 2,time data type 3, datetime2 data type 4, DateTimeOffset data type
1,date data type Date. Format: YYYY-MM-DD Comment: The supported range is from ' 1000-01-01 ' to ' 9999-12-31 '. Its existence avoids the time when we value the data outside of the date 12AM
DECLARE @Date as Date SET @Date =getdate () print @Date results: 2017-04-03
The 2,time data type is exactly the same as the date type. He can only take the value of the time part, excluding the value of the date part.
DECLARE @time as time SET @time =getdate () [email protected] Results: 16:50:01.1830000
3, the DateTime2 data type increases from a datetime to a maximum range of 7 means that the number of decimal digits can take 7 digits if the number of decimal digits is 0.
DECLARE @DATETIME2 as DATETIME2 (0) SET @DATETIME2 =getdate () print @DATETIME2 results: 2017-04-03 16:57:32
DECLARE @DATETIME2_ as DATETIME2 (7) SET @DATETIME2_ =getdate () print @DATETIME2_ results: 2017-04-03 16:57:32.3230000
4, DateTimeOffset data type the existence of this data type I think he's just trying to solve the problem of time zone difference: His presence can take time to do +/-hh:mm (for example, US and China time difference 12 hours)
DECLARE @DATETIMEOFFSET_ as DATETIMEOFFSET (0) SET @DATETIMEOFFSET_ = ' 2017-12-04 21:21:21-12:00 ' minus 12 hours
New date type for SQL Server