Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to:
SQL Server
Azure SQL Database
Azure SQL Managed Instance
Azure Synapse Analytics
SQL database in Microsoft Fabric
The SYSDATETIMEOFFSET Transact-SQL (T-SQL) function returns a datetimeoffset(7) value that contains the date and time of the computer on which the instance of SQL Server is running. The time zone offset is included.
For an overview of all Transact-SQL date and time data types and functions, see Date and time data types and functions.
Transact-SQL syntax conventions
Syntax
SYSDATETIMEOFFSET ( )
Return types
datetimeoffset(7)
Remarks
Transact-SQL statements can refer to SYSDATETIMEOFFSET anywhere they can refer to a datetimeoffset expression.
SYSDATETIMEOFFSET is a nondeterministic function. Views and expressions that reference this function in a column can't be indexed.
Note
SQL Server obtains the date and time values by using the GetSystemTimeAsFileTime() Windows API. The accuracy depends on the computer hardware and version of Windows on which the instance of SQL Server is running. The precision of this API is fixed at 100 nanoseconds. The accuracy can be determined by using the GetSystemTimeAdjustment() Windows API.
Examples
The following examples use the six SQL Server system functions that return current date and time to return the date, time, or both. The values are returned in series; therefore, their fractional seconds might be different.
A. Show the formats that are returned by the date and time functions
The following example shows the different formats that are returned by the date and time functions.
SELECT SYSDATETIME(),
SYSDATETIMEOFFSET(),
SYSUTCDATETIME(),
CURRENT_TIMESTAMP,
GETDATE(),
GETUTCDATE(),
CURRENT_DATE;
Here's the result set.
SYSDATETIME() 2026-09-01 16:15:37.7418724
SYSDATETIMEOFFSET() 2026-09-01 16:15:37.7418724 -06:00
SYSUTCDATETIME() 2026-09-01 22:15:37.7418724
CURRENT_TIMESTAMP 2026-09-01 16:15:37.740
GETDATE() 2026-09-01 16:15:37.740
GETUTCDATE() 2026-09-01 22:15:37.740
CURRENT_DATE 2026-09-01
B. Convert date and time to date
The following example shows you how to convert date and time values to date.
SELECT CONVERT (DATE, SYSDATETIME()),
CONVERT (DATE, SYSDATETIMEOFFSET()),
CONVERT (DATE, SYSUTCDATETIME()),
CONVERT (DATE, CURRENT_TIMESTAMP),
CONVERT (DATE, GETDATE()),
CONVERT (DATE, GETUTCDATE()),
CURRENT_DATE;
Here's the result set.
SYSDATETIME() 2026-09-01
SYSDATETIMEOFFSET() 2026-09-01
SYSUTCDATETIME() 2026-09-01
CURRENT_TIMESTAMP 2026-09-01
GETDATE() 2026-09-01
GETUTCDATE() 2026-09-01
CURRENT_DATE 2026-09-01
C. Convert date and time to times
The following example shows you how to convert date and time values to time.
SELECT CONVERT (TIME, SYSDATETIME()),
CONVERT (TIME, SYSDATETIMEOFFSET()),
CONVERT (TIME, SYSUTCDATETIME()),
CONVERT (TIME, CURRENT_TIMESTAMP),
CONVERT (TIME, GETDATE()),
CONVERT (TIME, GETUTCDATE());
Here's the result set.
SYSDATETIME() 16:15:37.7418724
SYSDATETIMEOFFSET() 16:15:37.7418724
SYSUTCDATETIME() 22:15:37.7418724
CURRENT_TIMESTAMP 16:15:37.740
GETDATE() 16:15:37.740
GETUTCDATE() 22:15:37.740