Re: PG producing odd results on epoch timestamp to string conversion - Mailing list pgsql-general

From Tom Lane
Subject Re: PG producing odd results on epoch timestamp to string conversion
Date
Msg-id 17108.1315606439@sss.pgh.pa.us
Whole thread Raw
In response to PG producing odd results on epoch timestamp to string conversion  (Preston Landers <planders@gmail.com>)
Responses Re: PG producing odd results on epoch timestamp to string conversion
List pgsql-general
Preston Landers <planders@gmail.com> writes:
> SELECT TO_CHAR( TIMESTAMP WITH TIME ZONE 'epoch' + 1315503340 *
> INTERVAL '1 second', 'MM-DD-YYYY HH:MM:SS TZ');
> 09-08-2011 12:09:40 CDT

> As you can see, Python, SQL Server, and Oracle all agree that the
> timestamp 1315503340 means 12:35:40 CDT on that date.

So does Postgres.

regression=# set timezone = 'CST6CDT';
SET
regression=# select TIMESTAMP WITH TIME ZONE 'epoch' + 1315503340 *
INTERVAL '1 second';
        ?column?
------------------------
 2011-09-08 12:35:40-05
(1 row)

> Yet PostgreSQL
> shows a value that is exactly 26 minutes behind the others (12:09:40).

You've fat-fingered the to_char usage --- MM is month, not minutes
(I think you want MI for that).

            regards, tom lane

pgsql-general by date:

Previous
From: Preston Landers
Date:
Subject: PG producing odd results on epoch timestamp to string conversion
Next
From: Preston Landers
Date:
Subject: Re: PG producing odd results on epoch timestamp to string conversion