postgres query between yesterday at time and today at time

Viewed 8566

I am fairly new to postgres and I'm struggling with a query I have to write to get all records between yesterday at 18:00 and today at 18:00.

So far I've tried a predicate like this but it doesn't seem to be right because whilst the query runs I don't get the desired result...

WHERE 
   recon_vr.paymentDateTime >= CURRENT_DATE -1 + '18:00:00.000000'::time
AND    
   recon_vr.paymentDateTime >= CURRENT_DATE + '18:00:00.000000'::time

Could someone please help me with this?

Also, I am running the query from an integration tool which I have found sometimes has issues with the :: syntax. So any solutions without that would be greatly appreciated. But if none exists then that's fine too.

thanks in advance

2 Answers
Related