Hacker News new | ask | show | jobs
by castorp 1641 days ago
I never understood the need for a datediff function. In Postgres (or Oracle) you just subtract two timestamps and use the resulting interval. It's a different approach to the same problem.
1 comments

one is counting distance, the other one buckets. alias the fn name to datebucketdelta to make the different problems memorable individually. :)
Well for "counting buckets" you can use `date_bin()` since Postgres 14 which groups the difference between timestamps into defined intervals.