How to calculate the local datetime from a utc datetime in tsql (sql 2005)?

前端 未结 10 1536
Happy的楠姐
Happy的楠姐 2021-02-02 14:13

i want to loop over a period of time in tsql, and print the utc datetimes and our local variant. We live in UTC +1, so i could easily add 1 hour, but in the summertime we live i

10条回答
  •  天命终不由人
    2021-02-02 14:58

    You can use my SQL Server Time Zone Support project to convert between IANA standard time zones, as listed here.

    Example:

    SELECT Tzdb.UtcToLocal('2015-07-01 00:00:00', 'America/Los_Angeles')
    

提交回复
热议问题