Επεξεργασία

CURRENT_TIMEZONE_ID (Transact-SQL)

Applies to: SQL Server 2022 (16.x) and later versions Azure SQL Database Azure SQL Managed Instance SQL database in Microsoft Fabric

The CURRENT_TIMEZONE_ID Transact-SQL (T-SQL) function returns the ID of the time zone that a server or instance observes. For Azure SQL Managed Instance, the return value is based on the time zone of the instance itself assigned during instance creation, not the time zone of the underlying operating system.

Note

Azure SQL Database and SQL database in Microsoft Fabric support changing the default time zone from universal coordinated time (UTC). If you modify the time zone at the database or session level, this function returns local time based on the configured time zone value. For more information, see ALTER DATABASE SCOPED CONFIGURATION and SET TIME ZONE.

See Date and time data types and functions for an overview of all the Transact-SQL date and time data types and functions.

Transact-SQL syntax conventions

Syntax

CURRENT_TIMEZONE_ID ( )

Arguments

This function takes no arguments.

Return types

varchar

Remarks

CURRENT_TIMEZONE_ID is a non-deterministic function. You can't index views and expressions that reference this column.

Examples

The value returned reflects the actual time zone and language settings of the server or the instance.

SELECT CURRENT_TIMEZONE_ID();

The result is W. Europe Standard Time.