T-SQL Tutorial

T-SQL SwitchOffSet Date Function


The T-SQL SwitchOffSet is an date function and returns a datetimeoffset value that is changed from the stored time zone offset.

SwitchOffSet Syntax:

SWITCHOFFSET( DATETIMEOFFSET, timezone )

SwitchOffSet Example:

select switchoffset (CONVERT(datetimeoffset, GETDATE()), '-03:00') AS Result_1,
switchoffset (CONVERT(datetimeoffset, GETDATE()), '+03:00') AS Result_2;

Result_1Result_2
2014-03-01 13:07:18.3270000 -03:002014-03-01 19:07:18.3270000 +03:00