Skip to main content
The following tables show the Date/Time operators that are available for the DATE/TIME/TIMESTAMP data types. See Date/Time types. All the following operators and functions return their values without a time zone.

Date/Time Functions

Note: DATE_PART() and EXTRACT() provide similar functionality and accept the same set of units. However, DATE_PART() requires the unit argument to be passed as a string (e.g. ‘YEAR’, ‘day’), while EXTRACT() also accepts these units as keywords. The following units are supported for TIME objects: hour, minute, second, milliseconds, microseconds. The following units are supported for DATE objects: millennium, century, decade, year, quarter, month, week (indicates the week number in the year), day (indicates the day number in the month). For TIMESTAMP objects, both the date and time units are supported.

Date/Time Operators

OperatorDescription and CommentsExample
DATE + INT => DATEAdd a given number of days to a given date.SELECT '2008-12-15'::DATE + 30;
=> 2009-01-14
DATE - INT => DATESubtract a given number of days from a given date.SELECT '2008-12-15'::DATE - 30;
=> 2008-11-15
DATE + TIME ⇒ TIMESTAMP
TIME + DATE ⇒ TIMESTAMP
Combine a date and a time, returning a timestamp object.SELECT '2008-12-15'::DATE + '01:00:00'::TIME
=> 2008-12-15 01:00:00
DATE - DATE => INTReturn difference in days between two dates.SELECT '2009-01-14'::DATE - '2008-12-15'::DATE;
=> 30
SELECT '2009-01-14'::DATE - '2009-12-15'::DATE;
=> -335