Getdate() function to get date for my timezone

后端 未结 5 1048
执念已碎
执念已碎 2021-01-05 05:49

I would love to insert a default value into a column with data type datetime2(7). However, because my website is hosted on a server in a different timezone, the getdate func

5条回答
  •  执笔经年
    2021-01-05 05:50

    Since Sql Server 2016 you can use AT TIME ZONE...

    SELECT CONVERT(datetime2(0), '2015-03-29T01:01:00', 126)     
    AT TIME ZONE 'Central European Standard Time';  
    

    ... as specified in the documentation

提交回复
热议问题