Convert UTC to local time in SQL Server

 Thanks to this StackOverflow answer:

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

Comments

Popular posts from this blog

Left Join in Entity Framework

C# Record Serialization

Mustache with JavaScript in Browser