CURRENT_TIMESTAMP (Transact-SQL)

**APPLIES TO:** ![yes](media/yes.png)SQL Server (starting with 2008) ![yes](media/yes.png)Azure SQL Database ![yes](media/yes.png)Azure SQL Data Warehouse ![yes](media/yes.png)Parallel Data Warehouse

[!div class=“nextstepaction”] Please help improve SQL Server docs!

This 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, SYSUTCDATE, and SYSDATETIMEOFFSET to a variable of any of the date and time types.

This function is the ANSI SQL equivalent to GETDATE.

See Date and Time Data Types and Functions for an overview of all the Transact\-SQL date and time data types and functions.

Topic link icon Transact-SQL Syntax Conventions

Syntax

CURRENT_TIMESTAMP  

Arguments

This function takes no arguments.

Return Type

datetime

Remarks

Transact\-SQL statements can refer to CURRENT_TIMESTAMP, anywhere they can refer to a datetime expression.

CURRENT_TIMESTAMP is a nondeterministic function. Views and expressions that reference this column cannot be indexed.

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. Note that the actual values returned will reflect the actual day / time of execution.

A. Get the Current System Date and Time

SELECT SYSDATETIME()  
    ,SYSDATETIMEOFFSET()  
    ,SYSUTCDATETIME()  
    ,CURRENT_TIMESTAMP  
    ,GETDATE()  
    ,GETUTCDATE();  
/* Returned:  
SYSDATETIME()      2007-04-30 13:10:02.0474381  
SYSDATETIMEOFFSET()2007-04-30 13:10:02.0474381 -07:00  
SYSUTCDATETIME()   2007-04-30 20:10:02.0474381  
CURRENT_TIMESTAMP  2007-04-30 13:10:02.047  
GETDATE()          2007-04-30 13:10:02.047  
GETUTCDATE()       2007-04-30 20:10:02.047  
*/

B. Get the Current System Date

SELECT CONVERT (date, SYSDATETIME())  
    ,CONVERT (date, SYSDATETIMEOFFSET())  
    ,CONVERT (date, SYSUTCDATETIME())  
    ,CONVERT (date, CURRENT_TIMESTAMP)  
    ,CONVERT (date, GETDATE())  
    ,CONVERT (date, GETUTCDATE());  
  
/* Returned   
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  
*/  

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());  
  
/* Returned  
SYSDATETIME()      13:18:45.3490361  
SYSDATETIMEOFFSET()13:18:45.3490361  
SYSUTCDATETIME()   20:18:45.3490361  
CURRENT_TIMESTAMP  13:18:45.3470000  
GETDATE()          13:18:45.3470000  
GETUTCDATE()       20:18:45.3470000  
*/  

Examples: [!INCLUDEssSDWfull] and [!INCLUDEssPDW]

SELECT CURRENT_TIMESTAMP;  

See also

CAST and CONVERT (Transact-SQL)