In SQL Server, the TODATETIMEOFFSET()
function was specifically designed to return a datetimeoffset value from a datetime2 value.
Given the fact that the datetime2 data type doesn’t actually support time zone offsets, and datetimeoffset must contain the offset, the TODATETIMEOFFSET()
function allows you to specify a time zone offset to use.
This article provides some examples to demonstrate.
Continue reading