Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 9C3D1930E1E for ; Fri, 3 Aug 2012 05:31:59 -0300 (ADT) Received: from 10610.x.rootbsd.net ([204.109.60.69] helo=vps001.shopzeus.com) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SxDIc-0006JL-FV for pgsql-admin@postgresql.org; Fri, 03 Aug 2012 08:31:58 +0000 Received: from [192.168.1.105] (localhost [127.0.0.1]) by vps001.shopzeus.com (8.14.3/8.14.3) with ESMTP id q738VkoU055724; Fri, 3 Aug 2012 04:31:47 -0400 (EDT) (envelope-from gandalf@shopzeus.com) Message-ID: <501B8C6F.6040100@shopzeus.com> Date: Fri, 03 Aug 2012 10:31:43 +0200 From: Laszlo Nagy User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: pgsql-admin@postgresql.org CC: Daniel Fekete Subject: Messed up time zones Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -0.0 (/) X-Archive-Number: 201208/15 X-Sequence-Number: 39836 select abbrev,utc_offset,count(*) from pg_timezone_names where abbrev='EST' 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 work: select now() at time zone 'Australia/ATC' -- time zone "Australia/ATC" not recognized 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) from pg_timezone_names group by abbrev having count(distinct utc_offset)>1 order by 2 desc "CST";3 "CDT";2 "AST";2 "GST";2 "IST";2 "WST";2 "EST";2 How should I store the user's preferred time zone, and how am I supposed to convert dates into that time zone? Thanks, Laszlo