2008-02-04

* postgreSQL : integer(timestamp) to date string

select to_char(1202050800::int4::abstime, 'YYYY-MM-DD HH24::MI:SS');
select to_char(1202050800::abstime, 'YYYY-MM-DD HH24::MI:SS');

test=# select to_char(1202050800::int4::abstime, 'YYYY-MM-DD HH24::MI:SS');
to_char
----------------------
2008-02-04 00::00:00
(1 row)

test=# select to_char(1202050800::abstime, 'YYYY-MM-DD HH24::MI:SS');
to_char
----------------------
2008-02-04 00::00:00
(1 row)

test=# select version();
version
----------------------------------------------------------------------
PostgreSQL 7.4.1 on i386-unknown-freebsd4.11, compiled by GCC 2.95.4
(1 row)

=======>

testdb=# select to_char(1202050800::abstime, 'YYYY-MM-DD HH24::MI:SS');
to_char
----------------------
2008-02-04 00::00:00
(1 row)

testdb=# select to_char(1202050800::int4::abstime, 'YYYY-MM-DD HH24::MI:SS');
to_char
----------------------
2008-02-04 00::00:00
(1 row)

testdb=# select version();
version

--------------------------------------------------------------------------------
----------
PostgreSQL 8.2.5 on i686-pc-mingw32, compiled by GCC gcc.exe (GCC) 3.4.2 (mingw
-special)
(1 row)




It Work at least on postgres version 7.4.1 and 8.2.5