How to specify timestamp along with date in postgresql

97 views Asked by At

I would like to specify a static timestamp along with dynamic date in postgresql

I am using now()-1 to get date. I am not sure how to specify static timestamp

The format should be 2015-06-12 20:45:00:00

Now I am using select now()-1 from dual to get previous date.

1

There are 1 answers

0
Craig Ringer On BEST ANSWER

It's pretty hard to be sure as you haven't really shown your inputs and outputs, but I'm guessing you want a timestamp with a variable date part and fixed time part.

If so, you probably want something like:

SELECT (current_date - INTERVAL '1' DAY) + INTERVAL '20:45:00';