Re: date_trunc() in a specific time zone

Поиск
Список
Период
Сортировка
От Vik Fearing
Тема Re: date_trunc() in a specific time zone
Дата
Msg-id 2f89a165-42d3-5813-be71-23340018d44f@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: date_trunc() in a specific time zone  (Andreas Karlsson <andreas@proxel.se>)
Ответы Re: date_trunc() in a specific time zone
Re: date_trunc() in a specific time zone
Список pgsql-hackers
On 29/10/2018 16:26, Andreas Karlsson wrote:
> On 10/29/2018 04:18 PM, 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.
> 
> 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')

Because I don't want '2001-02-16 00:00:00' (where?), I want the precise
moment in time that that represents ('2001-02-16 13:00:00+00') so I can
pull the correct rows out of my big table.

This isn't for display purposes.
-- 
Vik Fearing                                          +33 6 46 75 15 36
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Vik Fearing
Дата:
Сообщение: Re: date_trunc() in a specific time zone
Следующее
От: Tomas Vondra
Дата:
Сообщение: Re: FETCH FIRST clause WITH TIES option