date_trunc() in a specific time zone

Vik Fearing <vik.fearing@2ndquadrant.com>

From: Vik Fearing <vik.fearing@2ndquadrant.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2018-10-29T15:18:23Z
Lists: pgsql-hackers

Attachments

A use case that I see quite a lot of is needing to do reports and other
calculations on data per day/hour/etc but in the user's time zone.  The
way to do that is fairly trivial, but it's not obvious what it does so
reading queries becomes just a little bit more difficult.

Attached is a patch to create a function for it, based off 5953c99697.
-- 
Vik Fearing                                          +33 6 46 75 15 36
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support

Commits

  1. Add a timezone-specific variant of date_trunc().