DAY

Returns as an integer the day of the month from the input value.

Returns as an integer the day of the month from the input value.

Behavior type

  • Immutable if the input value is a TIMESTAMP, DATE, VARCHAR, or INTEGER

  • Stable if the specified date is a TIMESTAMPTZ

Syntax

DAY ( value )

Parameters

value
The value to convert, one of the following: TIMESTAMP, TIMESTAMPTZ, INTERVAL, VARCHAR, or INTEGER.

Examples

=> SELECT DAY (6);
 DAY
-----
   6
(1 row)

=> SELECT DAY(TIMESTAMP 'sep 22, 2011 12:34');
 DAY
-----
  22
(1 row)

=> SELECT DAY('sep 22, 2011 12:34');
 DAY
-----
  22
(1 row)

=> SELECT DAY(INTERVAL '35 12:34');
 DAY
-----
  35
(1 row)