Higher-Precision System Date and Time Functions
Sysdatetime()
The Sysdatetime function returns a datetime value that contains the current date and time of the system. This function does not contain time zone offset with date and time.
Example
-- SYSDATETIME Function
select SYSDATETIME() as [SYSDATETIME Function]
Output

Sysdatetimeoffset()
The Sysdatetimeoffset function returns a datetimeoffset value that contains the current date and time of the system. This function includes the time zone offset with date and time.
Example
-- Sysdatetimeoffset Function
select Sysdatetimeoffset() as [Sysdatetimeoffset Function]
Output

Sysutcdatetime()
The Sysutcdatetime function returns a datetime value that contains the current date and time of the system. The date and time is returned as UTC time (Coordinated Universal Time).
Example
-- Sysutcdatetime Function
select Sysutcdatetime() as [Sysutcdatetime Function]
Output

Lower-Precision System Date and Time Functions
Current_timestamp
The Current_timestamp function returns a datetime value that contains the date and time of the system. This function does not contain time zone offset with date and time.
Example
-- CURRENT_TIMESTAMP Function
select CURRENT_TIMESTAMP as [CURRENT_TIMESTAMP Function]
Output

Getdate()
Returns a datetime2(7) value that contains the date and time of the computer on which the instance of SQL Server is running. This function does not includes time zone offset with date and time.
Example






Join the conversation! Your thoughts help the community grow.