make_date()

A function for creating a date from individual values

make_date() is a system function for assembling a date value from the year, month and day.

make_date() was added in PostgreSQL 9.4.

Usage

make_date ( year int, month int, day int ) → date

An error is raised if any of the provided parameters is invalid.

Change history

Examples

Basic usage example for make_date():

postgres=# SELECT make_date(2021, 8, 29);
 make_date  
------------
 2021-08-29
(1 row)

Providing a negative year value:

postgres=# SELECT make_date(-100, 10, 1);
   make_date   
---------------
 0100-10-01 BC
(1 row)

Providing one or more invalid parameters:

postgres=# SELECT make_date(2021, 99, 99);
ERROR:  date field value out of range: 2021-99-99

Categories

Date and time, System function

See also

make_time(), make_timestamp(), make_timestamptz(), make_interval()