Skip to content

GETDATE

SELECT GETDATE() AS CurrentDateTime;
---------------
CurrentDateTime
---------------
2022-10-10 18:40:12.123

The GETDATE() function retrieves the current date and time from the SQL Server. The result is returned in ‘YYYY-MM-DD hh:mm:ss.mmm’ format. In the provided example, CurrentDateTime shows the current date and time at which the query was executed.