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
Software development tutorials and demos lasting no more than 60 seconds. No in-depth explanations, no off-topic rants, and no slides. One small topic per video - only code, console, config, and client. All videos come with a corresponding blog entry, and all code is available on GitHub.
Thanks to this StackOverflow answer:
convert( datetime, switchoffset( convert(datetimeoffset, MyTable.UtcColumn), datename(TzOffset, sysdatetimeoffset()) ) ) as ColumnInLocalTime
Comments
Post a Comment