SQL SWITCHOFFSET

The SQL Server SWITCHOFFSET is one of the Date and Time Function, which will convert the current time zone offset value to the specified time zone. The basic syntax of the SWITCHOFFSET function is

SWITCHOFFSET (DateTimeOffset_Value, Time_Zone)

SQL SWITCHOFFSET Example

In this Date and Time Function example, we will show you how to use SWITCHOFFSET in SQL Server to change the time zone (offset value). Please refer to the list of SQL Date functions available on our SQL Server Tutorial page.

SELECT SYSDATETIMEOFFSET()	

SELECT SWITCHOFFSET(SYSDATETIMEOFFSET(), '-08:00')	

SELECT SWITCHOFFSET(SYSDATETIMEOFFSET(), '-04:00')
SQL SWITCHOFFSET Example

The next step is to learn about the SQL SYSDATETIMEOFFSET and SQL TODATETIMEOFFSET articles.

Categories SQL