Answers for "date difference in postgressql"

SQL
2

postgresql get difference in hours between two dates

select EXTRACT(
	EPOCH FROM now() - (now() - INTERVAL '5 HOUR')
)/3600

-- it will return 5
Posted by: Guest on March-04-2021
-1

postgresql get difference between two dates

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'));
Posted by: Guest on April-08-2020

Code answers related to "SQL"

Browse Popular Code Answers by Language