Computers & ProgrammingBackend DevelopmentSQL

SQL GETDATE Function

The SQL GETDATE function is used to get the current date and time. This function is used when querying a Microsoft SQL Server. For MySQL Server, you can use the NOW function.

Syntax

GETDATE()

Example

SELECT GETDATE() as [Current Date and Time]

Results

2021-12-12 23:03:14.873

Aside from querying for the current date and time, you could use this function in the configuration of a table so that the current date and time are used when null values are passed.

You can also use this function in an INSERT INTO statement as well. There are many different ways to use this function.

Leave a Comment

Your email address will not be published.

Scroll to Top