A function for creating a timestamp from individual values

make_timestamp() is a system function for assembling a timestamp value from the provided year, month, day, hour, minute and second.

make_timestamp() was added in PostgreSQL 9.4.


make_timestamp ( year int, month int, day int, hour int, min int, sec double precision ) → timestamp

All parameters must be provided.

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

Change history


Basic usage example for make_timestamp():

postgres=# SELECT make_timestamp(2021,8,29,23,10,56.32);
 2021-08-29 23:10:56.32
(1 row)

Providing one or more invalid date parameters:

postgres=# SELECT make_timestamp(2021,13,29,23,10,11.22);
ERROR:  date field value out of range: 2021-13-29

Providing one or more invalid time parameters:

postgres=# SELECT make_timestamp(2021,8,29,25,10,99.32);
ERROR:  time field value out of range: 25:10:99.32


Date and time, System function

See also

make_date(), make_time(), make_timestamptz(), make_interval()