A Gentle Introduction to

SQL


Pick an engine:

Date Calculations

Different implementations of SQL have different functions for calculation on dates

d is 20th May 1962
QuestionAnswerAccess MySQL
Which year?1962year(d) year(d)
Which month?5month(d) month(d)
Which day?20day(d) day(d)
Day of the week?7 (Sunday)weekday(d) dayofweek(d)
The day after21 May 1962d+1 date_add(d, interval 1 day)
Todays date/time? Now() now()