Answers for "how to get data between two date on postgresql"

SQL
1

postgresql difference between two dates in days

SELECT
  AGE('2012-03-05', '2010-04-01'),
  DATE_PART('year', AGE('2012-03-05', '2010-04-01')) AS years,
  DATE_PART('month', AGE('2012-03-05', '2010-04-01')) AS months,
  DATE_PART('day', AGE('2012-03-05', '2010-04-01')) AS days;
 
...  
-- This will give you full years, month, days ... between two dates:

--          age          | years | months | days
-- -----------------------+-------+--------+------
--  1 year 11 mons 4 days |     1 |     11 |    4
Posted by: Guest on March-11-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 "how to get data between two date on postgresql"

Code answers related to "SQL"

Browse Popular Code Answers by Language