Re: date_trunc() in a specific time zone
David Fetter <david@fetter.org>
From: David Fetter <david@fetter.org>
To: Vik Fearing <vik.fearing@2ndquadrant.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2018-11-04T20:35:22Z
Lists: pgsql-hackers
On Mon, Oct 29, 2018 at 04:18:23PM +0100, Vik Fearing wrote: > 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. +1 In a slightly related matter, at some point, we also need to come up with a timestamptz2 or some such which preserves the input time zone. Best, David. -- David Fetter <david(at)fetter(dot)org> http://fetter.org/ Phone: +1 415 235 3778 Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate
Commits
-
Add a timezone-specific variant of date_trunc().
- 600b04d6b5ef 12.0 landed