0

I am in need to select all rows from table a that have updated_at newer than a given (epoch) timestamp, '1549312452' for example.

I am using node.js. When the client sends up that timestamp, I have the server convert it to date:

var date = new Date(timestmapInt * 1000);

I then run the following query:

`select * from a where a.updated_at > ${date}`

When I hit the endpoint I get this error:

"syntax error at or near \"Feb\""

So, in general, how can I query records newer than a certain date if my incoming parameter is 1549312452 in Postgresql?

1 Answer 1

2

You can pass the raw epoch to to_timestamp:

select * from a where a.updated_at > to_timestamp(1549312452)
Sign up to request clarification or add additional context in comments.

1 Comment

worked. I did not know about the to_timestamp() func. Thank you.

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.