How do I update a column's offset in SQL Server? How do I update a column's offset in SQL Server? sql sql

How do I update a column's offset in SQL Server?


You can use SWITCHOFFSET to change the offset. You will need to subtract the amount of hours though from the date if you don't want the date to change.

SELECT  SWITCHOFFSET(DATEADD(hh, -1, CAST (GETDATE() AS DATETIMEOFFSET)),                         '+01:00')


You can use TODATETIMEOFFSET(datetime, '+01:00' )This wont affect the datetime part.


DECLARE @t DATETIMEOFFSETSELECT @t = Getdate()SELECT Replace(@t, RIGHT(@t, 6), '+01:00') <update tablename set offsetfield = Replace(offsetfield, RIGHT(offsetfield, 6), '+01:00')>