How to set the time of a "timestamp" to 23:59:59 in postgresql?

Asked

Viewed 425 times

0

I have in a cell that contains only the date, in case 2018-07-11, I need to make a select that will bring this cell so: 2018-07-11 23:59:59, it is possible to do this?

  • In case you want the select to bring the date and time, but in the cell there is only the date? would that be?

  • What is your purpose ? Compare dates ? Have you ever thought about doing a CAST for DATE at the time of comparison ?

1 answer

1


Operations with dates in postgresql are easy to implement, as we see in documentation

In your case just do:

SELECT data, data + time '23:59:59'
FROM datas

You can see it working on SQL Fiddle.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.