0

I have such a query:

select
(featuremap ->> 'column.time:value')
from db.table;

This returns the unix timestamp as a string value. I tried several things: E.g.:

select
extract(epoch from(featuremap ->> 'column.time:value'))
from db.table;

Which returns this error: ERROR: function pg_catalog.date_part(unknown, text) does not exist

And:

select
to_timestamp(featuremap ->> 'column.time:value')
from db.table;

which returns this error: ERROR: function to_timestamp(text) does not exist

What do I have to do in this case in order to get the date and time from the unix timestamp string/text field?

0

1 Answer 1

1

Use to_timestamp with a single epoch argument. Since the original type of the argument is text it needs to be first cast to a numeric type.

select
to_timestamp((featuremap ->> 'column.time:value')::double precision)
from db.table;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.