SQL
Date Functions API Reference
SQL date and time functions for current values, arithmetic and formatting.
By EZ4Code Team
Date Functions
Functions for working with dates and times (MySQL dialect unless noted).
NOW()Return the current date and time as a single value (MySQL / PostgreSQL).
Returns: datetime
CURDATE()Return the current date (no time). MySQL function. Use CURRENT_DATE in standard SQL.
Returns: date
DATE_ADD(date, INTERVAL expr unit)Add an interval to a date. (MySQL; use date + INTERVAL '...' in PostgreSQL.)
Returns: datetime
DATE_SUB(date, INTERVAL expr unit)Subtract an interval from a date. (MySQL.)
Returns: datetime
DATEDIFF(date1, date2)Return date1 - date2 in days. (MySQL; arguments reversed in SQL Server.)
Returns: int
DATE_FORMAT(date, format)Format a date according to a format string. (MySQL; TO_CHAR in PostgreSQL.)
Returns: string
EXTRACT(unit FROM date)Extract a part of a date (YEAR, MONTH, DAY, HOUR, ...). Standard SQL.
Returns: int