Re: date_trunc() in a specific time zone

From: Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>
To: vik(dot)fearing(at)2ndquadrant(dot)com
Cc: Steve Crawford <scrawford(at)pinpointresearch(dot)com>, andreas(at)proxel(dot)se, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: date_trunc() in a specific time zone
Date: 2018-10-29 16:50:07
Message-ID: CA+renyVsqctZDsAPB15NPXPO5NEC2ELmTz=pEWoNZZDSjmeFeg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 29, 2018 at 9:40 AM Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com> wrote:
> I don't necessarily want to
> display any dates, I could be grouping and aggregating.

I can attest that this patch would be really nice functionality to
have. Grouping is an often-overlooked case where timezones matter.
When grouping by day (e.g.), the timezone determines where you "slice
up" the timeline. I've needed this often enough that I have a personal
extension for it (https://github.com/pjungwir/pjpg) but that repo is a
bit sloppy, and I can't use it on managed services like RDS.

It would be nice to support both timestamptz and timestamp, with the
output matching whatever type you give as input. I know which to use
is controversial, but plain timestamp is the default in Ruby on Rails,
so people encounter it a lot.

Yours,
Paul

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-10-29 16:53:16 Re: date_trunc() in a specific time zone
Previous Message Andrew Gierth 2018-10-29 16:47:43 Re: FETCH FIRST clause WITH TIES option