DATETIMEOFFSET Datatype

Posted: November 21, 2011 in SQL Server 2008

This datatype defines a date that is combined with a time of a day that has time zone awareness. This is based on a 24-hour clock and can be used as follows:

-- Declare variables
DECLARE @dt  DATETIMEOFFSET(0) = '2007-10-29 22:50:55 -1:00';
DECLARE @dt1 DATETIMEOFFSET(0) = '2007-10-29 22:50:55 +5:00';

-- Get the hour difference
SELECT DATEDIFF(hh, @dt, @dt1);
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s