Re: PG producing odd results on epoch timestamp to string conversion
| От | Tom Lane |
|---|---|
| Тема | Re: PG producing odd results on epoch timestamp to string conversion |
| Дата | |
| Msg-id | 17108.1315606439@sss.pgh.pa.us обсуждение |
| Ответ на | PG producing odd results on epoch timestamp to string conversion (Preston Landers <planders@gmail.com>) |
| Ответы |
Re: PG producing odd results on epoch timestamp to string conversion
|
| Список | 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 по дате отправления: