select abbrev,utc_offset,count(*) from pg_timezone_names
group by abbrev,utc_offset
There are 12 times zones with 'EST' code, offset = GMT+10. And there are
8 time zones with 'EST' code, offset= GMT+5 at the same time!
So how much it is supposed to be?
select now() at time zone 'UTC' - now() at time zone 'EST'
(Actually it returns +5:00 but what is the explanation?)
And how am I supposed to convert a date to Australian zone? This doesn't
select now() at time zone 'Australia/ATC' -- time zone "Australia/ATC"
Background: we have a site where multiple users are storing data in the
same database. All dates are stored in UTC, but they are allowed to give
their preferred time zone as a "user preference". So far so good. The
users saves the code of the time zone, and we convert all timestamps in
all queries with their preferred time zone. But we got some complaints,
and this is how I discovered the problem.
Actually, there are multiple duplications:
select abbrev,count(distinct utc_offset)
group by abbrev
having count(distinct utc_offset)>1
order by 2 desc
How should I store the user's preferred time zone, and how am I supposed
to convert dates into that time zone?
pgsql-performance by date
|Next:||From: JC de Villa||Date: 2012-08-03 08:58:28|
|Subject: Re: Messed up time zones|
|Previous:||From: Kevin Grittner||Date: 2012-08-02 20:13:01|
|Subject: Re: query using incorrect index|
pgsql-admin by date
|Next:||From: Laszlo Nagy||Date: 2012-08-03 08:37:11|
|Subject: Re: need help to write a function in postgresql|
|Previous:||From: Scott Marlowe||Date: 2012-08-02 16:44:32|
|Subject: Re: VACUUM ANALYZE block the whole database|