Tag Archives: ToDateTimeOffset

More on T-SQL DateTimeOffset, DatePart,ToDateTimeOffset, SwitchOffset and Timezones

SELECT CAST(‘2007-05-08 12:35:29.1234567 +12:15’ AS datetimeoffset(3)) AS ‘datetimeoffset’ ,DATEPART(tz,CAST(‘2007-05-08 12:35:29.1234567 +12:15’ AS datetimeoffset(3))) AS ‘timezoneoffset’ ,TODATETIMEOFFSET(CAST(‘2007-05-08 12:35:29.1234567’ as datetimeoffset(3)), 735) as rebuilt datetimeoffset What we started with and want to end with. timezoneoffset What the DatePart extracted from the original … Continue reading

Posted in Brian's Code Extreme, SQL, T-SQL | Tagged , , | Leave a comment