Date Calculations
- MySQL provides several functions to perform calculations on dates.
- Calculate ages.
- Extract pair of dates.
- MySQL expects dates in 'YYYY-MM-DD' format.
- MySQL provides several functions for extracting parts of dates.
YEAR()
- Extracts the year of a given date.
MONTH()
- Extracts the month of a given date.
DAYOFMONTH()
- Extracts the day of the month of a given date.
CURDATE()
- Provides the current date.
DATE_ADD()
- Adds a time interval to a given date.
How does MySQL handle NULL values?
© 2007 John Michael Pierobon
Notes