The results are intervals, which tell us the difference between the two timestamps:
0 years 0 mons 1673 days 23 hours 16 mins 0.00 secs
PostgresSQL provides the interval data type. The simplest way to create an interval in with the syntax:
INTERVAL 'x field'
x
is a number, its unit can be any of millennium
, century
, decade
, year
, month
, week
, day
, hour
, minute
, second
, millisecond
, microsecond
, or abbreviations (y
, m
, d
, etc.) or plural forms (months
, days
, etc.). Example intervals can be:
INTERVAL '2 hours'
INTERVAL '3 days'
INTERVAL '5 months'
INTERVAL '1 year'
You can add such intervals to a date/timestamp:
SELECT
id,
launched_timestamp,
launched_timestamp + INTERVAL '1 year' AS new_launched_timestamp
FROM aircraft;
The above query will add one year to each launched timestamp in the aircraft
table.