Bemærk
Adgang til denne side kræver godkendelse. Du kan prøve at logge på eller ændre mapper.
Adgang til denne side kræver godkendelse. Du kan prøve at ændre mapper.
Applies to:
SQL Server
Azure SQL Database
Azure SQL Managed Instance
Azure Synapse Analytics
SQL analytics endpoint in Microsoft Fabric
Warehouse in Microsoft Fabric
SQL database in Microsoft Fabric
The CURRENT_TIMESTAMP Transact-SQL (T-SQL) function returns the current database system timestamp as a datetime value, without the database time zone offset. CURRENT_TIMESTAMP derives this value from the operating system of the computer on which the instance of SQL Server runs.
Note
SYSDATETIME and SYSUTCDATE have more precision, as measured by fractional seconds precision, than GETDATE and GETUTCDATE. The SYSDATETIMEOFFSET function includes the system time zone offset. You can assign SYSDATETIME, SYSUTCDATETIME, and SYSDATETIMEOFFSET to a variable of any of the date and time types.
This function is the ANSI SQL equivalent to GETDATE.
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_TIMESTAMP
Arguments
This function takes no arguments.
Return types
datetime
Remarks
Transact-SQL statements can refer to CURRENT_TIMESTAMP, anywhere they can refer to a datetime expression.
CURRENT_TIMESTAMP is a nondeterministic function. You can't index views and expressions that reference this column.
Examples
These examples use the six SQL Server system functions that return current date and time values, to return the date, the time, or both. The examples return the values in series, so their fractional seconds might differ. The actual values returned reflect the actual day and time of execution.
A. Get the current system date and time
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. Get the current system date
The following example shows you how to convert date and time values to the date data type.
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. Get the current system 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
Examples: Azure Synapse Analytics
SELECT CURRENT_TIMESTAMP;