problem with unixtime conversion
problem with unixtime conversion
От:
"Nathan Suderman" <nathan@pollstar.com>
Дата:
does anyone know why I get the following error? running postgres 7.3.1
test=> select date(date_part('epoch','now'::date)::int);
ERROR: Bad date external representation '1042502400'
better yet does anyone have a better way to convert unixtime back to standard readable time?
Re: problem with unixtime conversion
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"Nathan Suderman" writes:
> test=> select date(date_part('epoch','now'::date)::int);
> ERROR: Bad date external representation '1042502400'
I think your code was relying on the int->abstime coercion, which was
implicitly invokable before 7.3, but now has to be specified explicitly.
regression=# select date(date_part('epoch','now'::date)::int::abstime);
date
------------
2003-01-13
(1 row)
regards, tom lane