On Transact SQL language the datetimeoffset is part of date and time data types and define a date that is combined with a time of a day that has time zone awareness.
Datetimeoffset syntax:
datetimeoffset [ (fractional seconds precision) ]
Property | Value |
---|---|
Default string literal format | YYYY-MM-DD hh:mm:ss[.nnnnnnn] [{+|-}hh:mm] |
Range | 0001-01-01 - 9999-12-31 |
Length | 26 minimum - 34 maximum |
Storage size | 10 bytes |
Datetimeoffset example:
USE model;
GO
DECLARE @datetimeoffset datetimeoffset(3) = '2014-08-21 10:49:32.1234 +10:0';
DECLARE @datetime2 datetime2(3)=@datetimeoffset;
SELECT @datetimeoffset AS 'Datetimeoffset', @datetime2 AS 'Datetime2';
GO
Datetimeoffset | Datetime2 |
---|---|
2014-08-21 10:49:32.123 +10:00 | 2014-08-21 10:49:32.123 |