Convert UTC to local time in SQL Server

Posted by Joe Enos on August 18, 2021 · 1 min read

 Thanks to this StackOverflow answer:

convert(
datetime,
switchoffset(
convert(datetimeoffset, MyTable.UtcColumn),
datename(TzOffset, sysdatetimeoffset())
)
) as ColumnInLocalTime