How to format bigint field into a date in Postgresql?

前端 未结 4 1913
囚心锁ツ
囚心锁ツ 2020-12-14 05:34

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         


        
4条回答
  •  余生分开走
    2020-12-14 06:24

    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"

提交回复
热议问题