'How do I get today items with JPQL

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 1:[1]

From today means from "00:00:00" until now?

select u from User u where u.timestamp > date_trunc('day', now());

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Frank N Stein