Re:PostgreSQL's Missing DateDiff Function
by funcDropShadow on Wednesday December 22, 2021 @08:40AM
(#29649120)
So, it is this:
> # SELECT date_part('year', '2021-01-01'::timestamptz) - date_part('year', '2020-12-31'::timestamptz) as years;
Or what am I missing?
[edit: formatting]
I don't think there's a good, mathematical expression for determining something as arbitrary as dates. If there was, I don't think MS would implement a special function like DateDiff for it.