Difference between two date timestamps month wise and year wise
suggest changeMonth-wise difference between two timestamps. This subtracts the year and month fields only, so the day of the month does not change the result. AgeonDate and tmpdate are columns.
select
(
(DATE_PART('year', AgeonDate) - DATE_PART('year', tmpdate)) * 12
+
(DATE_PART('month', AgeonDate) - DATE_PART('month', tmpdate))
)
from "Table1"
Year-wise difference between two timestamps:
select (DATE_PART('year', AgeonDate) - DATE_PART('year', tmpdate)) from "Table1"
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents