The AT TIME ZONE
clause was introduced in SQL Server 2016 to convert a date into a datetimeoffset value in a target time zone.
This function is similar to some other T-SQL functions, such as SWITCHOFFSET()
and TODATETIMEOFFSET()
, however, the AT TIME ZONE
clause allows/(requires) you to specify the time zone offset by name, instead of an actual offset value.
This article explores how AT TIME ZONE
works, and explains its benefits when compared to the other functions mentioned.