Difference between two date timestamps month wise and year wise

suggest change

Month-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"

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents