Quantcast
Channel: Question and Answer » postgresql
Viewing all articles
Browse latest Browse all 1138

Last occurance of time relative to now()

$
0
0

What’s the most elegant way to ask Postgres for the last 4:05pm relative to now()?

I have been writing a fairly elaborate CASE with date_trunc‘s and my guess is it can be accomplished in a much cleaner manner.

I speak with reference to no table. i.e. There is no FROM in this query. Just a simple SELECT.

The result of this is either a TIMESTAMP at 4:05pm today, or yesterday.


Viewing all articles
Browse latest Browse all 1138