Dates and timesPostgreSQL only

MAKE_DATE

Builds a date from separate numbers: the year, month and day.

Syntax

MAKE_DATE(<year>, <month>, <day>)
MAKE_TIMESTAMP(<year>, <month>, <day>, <hour>, <minute>, <second>)

Useful when the year, month and day are stored as separate numbers or calculated. Unlike gluing text together, you don't have to think about the format or leading zeros. For a date with a time there's MAKE_TIMESTAMP.

A date from three numbers
SELECT MAKE_DATE(2026, 9, 13) AS day;
day
2026-09-13
A date with a time
SELECT MAKE_TIMESTAMP(2026, 9, 13, 15, 47, 0) AS moment;
moment
2026-09-13 15:47:00
The last day of February
SELECT MAKE_DATE(2028, 3, 1) - 1 AS last_day_of_february;
last_day_of_february
2028-02-29

We take March 1 and subtract a day — leap years take care of themselves.

Watch out

A date that doesn't exist is an error, not a rollover into the next month: MAKE_DATE(2026, 2, 30) throws date field value out of range.

The arguments are integers. EXTRACT returns numeric, so MAKE_DATE(EXTRACT(YEAR FROM created_at), 1, 1) throws function make_date(numeric, integer, integer) does not exist. Cast the type: EXTRACT(YEAR FROM created_at)::int.

Related functions