Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
One of the powerful features in SQL is writing queries based on today's date and time. We'll use a function to get today's date.
SQLite
To get the current date use: DATE("now")
To get the current time use: TIME("now")
To get the current date time: DATETIME("NOW")
MS SQL
To get the current date use: CONVERT(date, GETDATE())
To get the current time use: CONVERT(time, GETDATE())
To get the current date time: GETDATE()
MySQL
To get the current date use: CURDATE()
To get the current time use: CURTIME()
To get the current date time: NOW()
Oracle and PostgreSQL
To get the current date use: CURRENT_DATE
To get the current time use: CURRENT_TIME
To get the current date time: `CURRENT_TIMESTAMP
Cheat Sheets
You need to sign up for Treehouse in order to download course files.
Sign up