Some of the new data that are introduced in Microsoft SQL Server 2008 are :
- Date
- Time
- Datetime2
- Datetimeoffset
Here is a simple self-explanatory example:
declare @date date = getdate()
declare @time time = getdate()
declare @dt2 datetime2 = getdate()
declare @dt datetime = getdate()
declare @sdt smalldatetime = getdate()
print 'Date ' + cast(@date as char)
print 'Time ' + cast(@time as char)
print 'SmallDateTime ' + cast(@sdt as char)
print 'DateTime ' + cast(@dt as char)
print 'DateTime2 ' + cast(@dt2 as char)
Here is the output of the same:
Date 2009-09-04
Time 16:18:54.5730000
SmallDateTime Sep 4 2009 4:19PM
DateTime Sep 4 2009 4:18PM
DateTime2 2009-09-04 16:18:54.5730000