problem with unixtime conversion
Started by Nathan Sudermanabout 23 years ago3 messagesgeneral
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
"Nathan Suderman" <nathan@pollstar.com> 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