PostgreSQL 18 reference · Date and Time Functions

PostgreSQL MAKE_INTERVAL() Function

Build an interval from named parts, such as make_interval(days => 10, hours => 2).

PostgreSQL 18 Since 9.4

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

make_interval(years, months, weeks, days, hours, mins, secs)

Parameters

ParameterDescription
parts Integers (seconds can be fractional); use named arguments.

Return value

interval.

Examples

Named parts
SELECT make_interval(days => 10, hours => 2) AS i;

Output

        i
------------------
 10 days 02:00:00
(1 row)

Run this on your computer — see “Get Started” for setup.

Add to a date
SELECT order_date, order_date + make_interval(days => 14) AS return_by
FROM orders
LIMIT 2;

Output

 order_date |      return_by
------------+---------------------
 2026-01-05 | 2026-01-19 00:00:00
 2026-01-12 | 2026-01-26 00:00:00
(2 rows)

Run this on your computer — see “Get Started” for setup.

For fixed values an interval literal is shorter: order_date + interval '14 days'.

Version history

VersionChange
PostgreSQL 9.4Added

Was this page helpful?