SQL Notebook (logo)

SWITCHOFFSET Function

Changes the time zone offset of a date/time string without affecting the date and time parts. For instance, the string "2016-07-23 22:21:35.870 -04:00" can be converted to "2016-07-23 22:21:35.870 +05:30", using a new time zone offset of "+05:30". This function is intended for use when a date/time was wrongly imported with an incorrect time zone, and the user wishes to change the time zone offset without changing the date and time part of the string.

Syntax

SWITCHOFFSET(date, time-zone)

Arguments

Return Value

Returns a date/time string containing the original date and time with the new time zone offset.

Examples