Date function

A date function (date_function) is a function that is applied to date or timestamp values or supplies a date or timestamp value as a result.


<date_function> ::=
  ADDDATE    ( <date_or_timestamp_expression>, <expression> )
DATEDIFF   ( <date_or_timestamp_expression>, <date_or_timestamp_expression> )
DAYNAME    ( <date_or_timestamp_expression> )
DAYOFMONTH ( <date_or_timestamp_expression> )
DAYOFWEEK  ( <date_or_timestamp_expression> )
DAYOFYEAR  ( <date_or_timestamp_expression> )
MAKEDATE   ( <expression>, <expression> )
MONTHNAME  ( <date_or_timestamp_expression> )
SUBDATE    ( <date_or_timestamp_expression>, <expression> )
WEEKOFYEAR ( <date_or_timestamp_expression> )

<date_or_timestamp_expression> ::= <expression>


SQL Tutorial, Date and Time Calculations


When used in a function, the argument date_or_timestamp_expression must supply a date, a time stamp, or an alphanumeric value that matches the current date or time stamp format.

Date and time values can be specified in a variety of date and time formats (ISO, USA, EUR, JIS, INTERNAL).

Although the Gregorian calendar was not introduced until 1582, it can also be applied to date functions that use dates prior to that year. This means that every year is assumed to have either 365 or 366 days.

See also:

Functions: Overview