Re: [ADMIN] Messed up time zones

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




All the above are the exact same point in time merely stated as relevant to each location. Note that given a timestamp with time zone and a zone, PostgreSQL returns a timestamp without time zone (you know the zone since you specified it).
Yes, I know the zone. But I don't know the offset from UTC.

Example:

template1=> set timezone to 'UTC';
SET
template1=> select ('2011-10-30 01:00:00'::timestamptz) at time zone 'Europe/Budapest';
      timezone
---------------------
 2011-10-30 02:00:00    -- Is it winter or summer time?
(1 row)

template1=> select ('2011-10-30 00:00:00'::timestamptz) at time zone 'Europe/Budapest';
      timezone
---------------------
2011-10-30 02:00:00 -- Is it winter or summer time? What is the offset from UTC here? Can you tell me when it was in UTC?
(1 row)

template1=>

What is more:

template1=> select (('2011-10-30 00:00:00'::timestamptz) at time zone 'Europe/Budapest') is distinct from (('2011-10-30 01:00:00'::timestamptz) at time zone 'Europe/Budapest');
 ?column?
----------
 f
(1 row)

template1=>

Yeah, we know what time zone it is in, but we don't know when it was, thanks a lot. :-( It would be unambiguous to store the UTC offset along with the value. But it is not how it was implemented.

--
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux