SQL TODATETIMEOFFSET Function

TODATETIMEOFFSET returns a datetimeoffset from the specified datetime.

The fractional precision is the same as the datetime value provided.

Example

#

This example returns a timezoneoffset with +8:00 for the specified date.

SELECT TODATETIMEOFFSET ('2022-09-28 8:54:16', '+08:00') 
       AS 'Datetime Offset'
Result:  1 record
Datetime Offset
2022-09-28 08:54:16.0000000 +08:00

Syntax

Syntax of the TODATETIMEOFFSET function .

TODATETIMEOFFSET(datetime, offset) 

datetime -- a datetime2 value or column name.

offset -- a timezone offset or signed integer representing from +14 to -14.


You may also like



Guides


vsn 3.1