Using the SwitchOffset function for Time Zones

preview_player
Показать описание
SwitchOffset is a function that will shift a time in one time zone to the correct time in another time zone. It takes a DATETIMEOFFSET data type, and produces a DATETIMEOFFSET data type.

Рекомендации по теме
Комментарии
Автор

T-SQL also supports a function called AT TIME ZONE that can be used instead of both the SWITCHOFFSET and the TODATETIMEOFFSET functions, and that uses named time zones instead of offsets.
Example select GETDATE() AT TIME ZONE 'Central America Standard Time'

Here is a list of time zones in SQL Server select * from sys.time_zone_info

wilhelminasihene
Автор

the problem with AT TIME ZONE is that if you assign that result to a Variable or a Temp Table it will display the original time zone

Wilsonciprian_