Remix.run Logo
▲ Handling dates and times in SQL queries with PostgreSQL(mon-code.net)
5 points by metfan 3 days ago | 3 comments
▲flossly 33 minutes ago | parent | next [-]

Lame article tbh.

It's better to use `timestampz` everywhere; the author seems to know but then uses `timestamp`...

Most of the functions showcased one will not need as one will do that in the app-layer or even in the frontend code.

▲traceroute66 36 minutes ago | parent | prev | next [-]

Interesting site, but its missing some of the more advanced things you can do in Postgres like `EXCLUDE USING gist` to prevent overlapping schedules.

▲ruslanty 3 days ago | parent | prev [-]

For reports by local date, I’d convert both local midnights to timestamptz separately, then filter with ts >= start AND ts < end. If you take the first midnight and just add 24 hours, you can miss an hour or pull in an hour from the next day when the clocks change