Returns the day of the month in the argument as a short integer value in the range of 1-31. The argument date_expression can be the name of a column, the result of another scalar function, or a date or timestamp literal.

Syntax

DAYOFMONTH ( date_expression )

Notes

  • The date_expression argument must be of type DATE.
  • If date_expressionis supplied as a date literal, it can be any of the valid date_literalformats where the day specification (DD) precedes the month specification (MM).
  • The result is of type SHORT.
  • If the argument expression evaluates to NULL, the result is NULL.

Example

This example illustrates the DAYOFMONTH function:

SELECT *
    FROM orders
    WHERE DAYOFMONTH (order_date) = 14 ;

Compatibility

ODBC compatible