0

I have a postgres date and posgres time column. Is there any postgres function to get postgres timestamp from these columns. This timestamp value is used to compare with the Java sql timestamp object.

9
  • Have you looked at the documentation? Commented Aug 1, 2018 at 9:59
  • yes, but it does not solve my purpose Commented Aug 1, 2018 at 10:05
  • PostgreSQL supports string concatenation with CONCAT or with double pipeline (||).. double pipes does not work on date and time without casting but CONCAT does something like this sqlfiddle.com/#!17/340e0/123 should help you out Commented Aug 1, 2018 at 10:37
  • We need the CREATE TABLE statement for the database table. Commented Aug 1, 2018 at 10:49
  • 3
    It doesn't require any string concatenation, and it's right there in the beginning of the documentation, the + operator. A date value plus a time value will give you a timestamp value. Isn't that your purpose? Commented Aug 1, 2018 at 11:41

1 Answer 1

1

You can just sum the two columns using + operator. When you sum a date with a time type, you'll get a timestamp as the answer.

Look at the first table's third line. https://www.postgresql.org/docs/current/functions-datetime.html

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.