SYSUTCDATETIME
returns the current UTC datetime on the database server.
This function can be used as the default value for DATETIME columns.
SYSUTCDATETIME
is equivalent to GETUTCDATE.
This example returns the current UTC datetime on the database server.
SELECT SYSUTCDATETIME() AS 'Now'
Now |
---|
2023-12-21 22:23:45.9692997 |
Syntax of the SYSUTCDATETIME function.
SYSUTCDATETIME()
SQL Server supports 6 system datetime functions.
SELECT CURRENT_TIMESTAMP AS 'CURRENT_TIMESTAMP',
SYSDATETIME() AS 'SYSDATETIME',
SYSDATETIMEOFFSET() AS 'SYSDATETIMEOFFSET',
SYSUTCDATETIME() AS 'SYSUTCDATETIME',
GETDATE() AS 'GETDATE',
GETUTCDATE() AS 'GETUTCDATE'
Function | Result |
---|---|
CURRENT_TIMESTAMP | 2021-09-12 18:14:15.007 |
SYSDATETIME() | 2021-09-12 18:14:15.0077586 |
SYSDATETIMEOFFSET() | 2021-09-12 18:14:15.0077586 -05:00 |
SYSUTCDATETIME() | 2021-09-12 23:14:15.0077586 |
GETDATE() | 2021-09-12 18:14:15.007 |
GETUTCDATE() | 2021-09-12 23:14:15.007 |
The results differ in microsecond precision and datetime offset values.