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.
DateTimeoffset (Timezone) conversion in SQL Server.
SQL Server 2016 (13.x) and later
Exmample
Select GETUTCDATE() Select Convert(DATETIME, GETUTCDATE() AT TIME ZONE 'UTC' AT TIME ZONE 'Central European Standard Time') Select Convert(DATETIME, GETUTCDATE() AT TIME ZONE 'UTC' AT TIME ZONE 'India Standard Time')
Result will be
2020-08-18 08:22:21.640 2020-08-18 10:22:21.640 2020-08-18 13:52:21.640