date_trunc() in a specific time zone

From: Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: date_trunc() in a specific time zone
Date: 2018-10-29 15:18:23
Message-ID: 6249ffc4-2b22-4c1b-4e7d-7af84fedd7c6@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
date_trunc_tz__001.patch text/x-patch 4.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andreas Karlsson 2018-10-29 15:26:31 Re: date_trunc() in a specific time zone
Previous Message Andrew Gierth 2018-10-29 15:17:28 Re: FETCH FIRST clause WITH TIES option