-- difference in seconds between two dates
select extract(epoch from ('2020-03-30 09:55:56'::timestamp - '2020-03-30 08:54:55'::timestamp));
-- result : 3661
select age('2010-04-01', '2012-03-05'),
date_part('year',age('2010-04-01', '2012-03-05')),
date_part('month',age('2010-04-01', '2012-03-05')),
date_part('day',age('2010-04-01', '2012-03-05'));
select EXTRACT(
EPOCH FROM now() - (now() - INTERVAL '5 HOUR')
)/3600
-- it will return 5