PostgreSQL: Converting data file string to epoch time

984 views Asked by At

I'm attempting to convert an epoch string value (listed as 'updated_date') within a data field to epoch time. See the output listed below: Any help would be greatly appreciated.

enter image description here

Here is a snippet of the query:

select created_at
      ,data -> 'skill_survey_recent_status' as status
      ,data -> 'skill_survey_recent_status_date' as updated_date 
from line_items 
where product_id = 2
order by 1 desc
1

There are 1 answers

0
AudioBubble On

Not sure what you mean with "epoch time", but to convert that to a proper timestamp value, use to_timestamp():

select created_at, 
       data -> 'skill_survey_recent_status' as status
       to_timestamp((data -> 'skill_survey_recent_status_date')::double precision) as updated_date 
from line_items 
where product_id = 2
order by 1 desc