Dofactory.com
Dofactory.com
Earn income with your data and sql skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

SQL SWITCHOFFSET Function

SWITCHOFFSET returns a datetimeoffset with a specified timezone.

This function does not change the underlying datetime value, only the display value.

Example

#

This example changes the timezone offset to +8:00 on the specified input datetimeoffset.

SELECT SWITCHOFFSET ('2022-09-28 8:54:16.1234 -5:00', 
                     '+08:00') AS '+8:00 Offset'
Result:  1 record
+8:00 Offset
2022-09-28 21:54:16.1234000 +08:00

Syntax

Syntax of the SWITCHOFFSET function .

SWITCHOFFSET(datetime, offset) 

datetime -- a datetime or column name.

offset -- an offset expression or signed integer representing timezone offset.


You may also like



Last updated on Dec 21, 2023

Earn income with your data and sql skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.