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
Syntax
make_interval(years, months, weeks, days, hours, mins, secs)
Parameters
| Parameter | Description |
|---|---|
parts |
Integers (seconds can be fractional); use named arguments. |
Return value
interval.
Examples
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.
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
| Version | Change |
|---|---|
| PostgreSQL 9.4 | Added |
Related
MAKE_DATE()· Build a date from year, month and day numbers. make_timestamp() and make_time() do the same for other types.AGE()· Subtract dates and return a 'symbolic' interval in years, months and days. With one argument it counts from today.- SQL Date Functions · tutorial