Re: date_trunc() in a specific time zone
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andreas Karlsson <andreas@proxel.se>
Cc: Vik Fearing <vik.fearing@2ndquadrant.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2018-10-29T15:36:32Z
Lists: pgsql-hackers
Andreas Karlsson <andreas@proxel.se> writes:
> Hm, I am not sure if I see any major win from writing
> date_trunc('day', timestamptz '2001-02-16 20:38:40+00', 'Australia/Sydney')
> instead of
> date_trunc('day', timestamptz '2001-02-16 20:38:40+00' AT TIME ZONE
> 'Australia/Sydney')
The latter would give you timestamp without time zone, whereas I think
what Vik wants is timestamp with time zone. Yeah, you could then convert
it back with a second application of AT TIME ZONE 'Australia/Sydney',
but that's both inefficient and mighty confusing.
regards, tom lane
Commits
-
Add a timezone-specific variant of date_trunc().
- 600b04d6b5ef 12.0 landed