How to format bigint field into a date in Postgresql? How to format bigint field into a date in Postgresql? postgresql postgresql

How to format bigint field into a date in Postgresql?


TO_CHAR(TO_TIMESTAMP(bigint_field / 1000), 'DD/MM/YYYY HH24:MI:SS')


This depends on what the bigint value represents - offset of epoch time, or not.

select to_timestamp(20120822193532::text, 'YYYYMMDDHH24MISS')

returns

"2012-08-22 19:35:32+00"


This is what worked for me

to_timestamp( bigint_field/1000)::date