Wednesday, August 19, 2020

SQL Server: Convert datetime from UTC to specific time zone

A clean and nice way to convert datetime from UTC to specific time zone using AT TIME ZONE.

SELECT CONVERT(datetime, CONVERT(datetimeoffset, GETDATE()) AT TIME ZONE 'E. Australia Standard Time');

This way can take into account DST too.