Issue
I need to get today's items from database (more specifically PostgreSQL) using JPQL.
I need all the items that their day is the same as today. I tried this but it is not working because the current timestamp and creation timestamp are not exactly the same due to different times. It does not return any result.
@Query("select u from User u where u.timestamp = current_timestamp")
The question is how do I only compare the day?
Solution
From today means from "00:00:00" until now?
select u from User u where u.timestamp > date_trunc('day', now());
Answered By - Frank N Stein
Answer Checked By - Robin (JavaFixing Admin)