How to convert Unix epoch to a timestamp

前端 未结 1 1540
失恋的感觉
失恋的感觉 2020-12-04 04:25

I am new to postgresql bot not to sql in general. I have a table that I need to read values from, on of the columns is a unix timestamp that I want to convert in to a more h

相关标签:
1条回答
  • 2020-12-04 04:45

    to_char() converts a number, date or timestamp to a string, not the other way round.

    You want to_timestamp()

    Convert Unix epoch (seconds since 1970-01-01 00:00:00+00) to timestamp


    So just apply that function on your column

    SELECT lt,dw,up,to_timestamp(uxts) as uxts 
    from products;
    

    This assumes that uxts is some kind of number data type (integer, bigint or double precision)

    0 讨论(0)
提交回复
热议问题