Events
Mar 31, 11 PM - Apr 2, 11 PM
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Applies to:
SQL Server
Azure SQL Database
Azure SQL Managed Instance
Azure Synapse Analytics
Analytics Platform System (PDW)
SQL analytics endpoint in Microsoft Fabric
Warehouse in Microsoft Fabric
Returns the current database system timestamp as a datetime value. The database time zone offset is not included. This value represents the current UTC time (Coordinated Universal Time). This value is derived from the operating system of the computer on which the instance of SQL Server is running.
Note
SYSDATETIME and SYSUTCDATETIME have more fractional seconds precision than GETDATE and GETUTCDATE. SYSDATETIMEOFFSET includes the system time zone offset. SYSDATETIME, SYSUTCDATETIME, and SYSDATETIMEOFFSET can be assigned to a variable of any of the date and time types.
For an overview of all Transact-SQL date and time data types and functions, see Date and Time Data Types and Functions (Transact-SQL).
Transact-SQL syntax conventions
GETUTCDATE()
datetime
Transact-SQL statements can refer to GETUTCDATE anywhere they can refer to a datetime expression.
GETUTCDATE is a nondeterministic function. Views and expressions that reference this function in a column cannot be indexed.
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.
SELECT 'SYSDATETIME() ', SYSDATETIME();
SELECT 'SYSDATETIMEOFFSET()', SYSDATETIMEOFFSET();
SELECT 'SYSUTCDATETIME() ', SYSUTCDATETIME();
SELECT 'CURRENT_TIMESTAMP ', CURRENT_TIMESTAMP;
SELECT 'GETDATE() ', GETDATE();
SELECT 'GETUTCDATE() ', GETUTCDATE();
Result set:
SYSDATETIME() 2007-05-03 18:34:11.9351421
SYSDATETIMEOFFSET() 2007-05-03 18:34:11.9351421 -07:00
SYSUTCDATETIME() 2007-05-04 01:34:11.9351421
CURRENT_TIMESTAMP 2007-05-03 18:34:11.933
GETDATE() 2007-05-03 18:34:11.933
GETUTCDATE() 2007-05-04 01:34:11.933
SELECT 'SYSDATETIME() ', CONVERT (date, SYSDATETIME());
SELECT 'SYSDATETIMEOFFSET()', CONVERT (date, SYSDATETIMEOFFSET());
SELECT 'SYSUTCDATETIME() ', CONVERT (date, SYSUTCDATETIME());
SELECT 'CURRENT_TIMESTAMP ', CONVERT (date, CURRENT_TIMESTAMP);
SELECT 'GETDATE() ', CONVERT (date, GETDATE());
SELECT 'GETUTCDATE() ', CONVERT (date, GETUTCDATE());
Result set:
SYSDATETIME() 2007-05-03
SYSDATETIMEOFFSET() 2007-05-03
SYSUTCDATETIME() 2007-05-04
CURRENT_TIMESTAMP 2007-05-03
GETDATE() 2007-05-03
GETUTCDATE() 2007-05-04
SELECT 'SYSDATETIME() ', CONVERT (time, SYSDATETIME());
SELECT 'SYSDATETIMEOFFSET()', CONVERT (time, SYSDATETIMEOFFSET());
SELECT 'SYSUTCDATETIME() ', CONVERT (time, SYSUTCDATETIME());
SELECT 'CURRENT_TIMESTAMP ', CONVERT (time, CURRENT_TIMESTAMP);
SELECT 'GETDATE() ', CONVERT (time, GETDATE());
SELECT 'GETUTCDATE() ', CONVERT (time, GETUTCDATE());
Result set:
SYSDATETIME() 18:25:01.6958841
SYSDATETIMEOFFSET() 18:25:01.6958841
SYSUTCDATETIME() 01:25:01.6958841
CURRENT_TIMESTAMP 18:25:01.6930000
GETDATE() 18:25:01.6930000
GETUTCDATE() 01:25:01.6930000
Events
Mar 31, 11 PM - Apr 2, 11 PM
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register today