SQL SERVER – Convert a given date from UTC to your time zone and daylight savings time

Let’s say you have a datetime value that you know is encoded in UTC (if you don’t know what timezone your data was originally encoded in you’re out of luck)

If you want to convert the UTC datetime to Eastern Standard Time calculating the right daylight saving time, you can use on AT TIME ZONE ‘UTC’ and then  AT TIME ZONE 'Eastern Standard Time'

select your_date at time zone 'UTC' at time zone 'W. Europe Standard Time' as MyDate

Leave a comment