GETDATE
GETDATE is a built-in function in SQL Server that returns the current datetime as a datetime datatype. It doesn't accept any parameters. The date and time are obtained from the operating system on which the SQL Server instance is running.
GETDATE()
Example
Output
Explanation
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.