How to format bigint field into a date in Postgresql?

Stephan picture Stephan · Mar 30, 2011 · Viewed 59.3k times · Source

I have a table with a field of type bigint. This field store a timestamp. I want to date format the field like this :

to_char( bigint_field,'DD/MM/YYYY HH24:MI:SS')

I get the following error :

ERROR: multiple decimal points
État SQL :42601

Answer

Quassnoi picture Quassnoi · Mar 30, 2011
TO_CHAR(TO_TIMESTAMP(bigint_field / 1000), 'DD/MM/YYYY HH24:MI:SS')