Did you find this useful?
Socialize it today.


SQL GETDATE Function

Friday, December 16, 2011

tags SQL

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

Current Date and Time
2011-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 is used when null values are passed. You can also use this function in an INSERT INTO statement as well. There are many differnt ways to use this function.

Please help us spread the word by socializing it today!

email contact us

Did you find something wrong with the information on this page? Please take a moment to report it to us so that we can continue to improve the quality of the information on this site. Click here to report an issue with this page.



Recommended Books & Training Resources

Head First SQL: Your Brain on SQL A Learners Guide SQL Cookbook