4

I'd love to have timestamp which composed of <[current date] + [specific time I can specify as a string]>.

Ex. 2016-03-08 23:59:59

  • 2016-03-08 => current date
  • 23:59:59 => I can specify

I'd love to do something like

cast(cast( now()::timestamp(0) AS string) || '23:59:59' ) AS timestamp )

in more postgres way.

1 Answer 1

11

Maybe try:

CURRENT_DATE + TIME '23:59:59'

I don't have access to a database atm so I can't test it out for you but I find Table 9-27 in the link below to be very useful (I find that whole webpage to be very useful).

http://www.postgresql.org/docs/9.1/static/functions-datetime.html

Sign up to request clarification or add additional context in comments.

2 Comments

Almost right. CURRENT_DATE + TIME '23:59:59' (without date).
Just tested it out on my local server. You are absolutely right Egor. Edited my answer to take into account your correction.

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.