How to calculate the number of days between two dates?
1
vote
1
answer
7339
views
I'm trying to calculate days between two dates.
Let's say I have the date **'2005-05-25 06:04:08'** and I want to count how many days are there between that day and the current date.
I tried doing:
SELECT DATE_PART('day', AGE(CURRENT_TIMESTAMP, '2005-05-25 06:04:08'::timestamp )) AS days;
But for some reason this returns 11, it's not taking into account the difference in years. How can I solve this?
Asked by Santi
(11 rep)
Jun 5, 2021, 08:33 PM
Last activity: Jun 10, 2024, 08:47 PM
Last activity: Jun 10, 2024, 08:47 PM