T-SQL Tutorial

T-SQL ToDateTimeOffSet Date Function


The T-SQL ToDateTimeOffSet is an date function and returns a datetimeoffset value that is translated from a datetime2 expression.

ToDateTimeOffSet Syntax:

TODATETIMEOFFSET ( expression , timezone )

ToDateTimeOffSet Example:

SELECT TODATETIMEOFFSET (GETDATE(), '-01:00') Result_1,
TODATETIMEOFFSET (SYSDATETIME(), -60) Result_2;

Result_1Result_2
2014-03-01 16:56:42.640 -01:002014-03-01 16:56:42.6419167 -01:00