How can I convert a Sql Server 2008 DateTimeOffset to a DateTime

后端 未结 6 1431
独厮守ぢ
独厮守ぢ 2020-11-27 05:15

I\'m hoping to convert a table which has a DATETIMEOFFSET field, down to a DATETIME field BUT recalculates the time by taking notice of the offset.

6条回答
  •  星月不相逢
    2020-11-27 06:13

    I'd use the built in SQL option:

    select SWITCHOFFSET(cast('2008-12-19 17:30:09.0000000 +11:00' as datetimeoffset),'+00:00')
    

提交回复
热议问题