[英]How do I get today items with JPQL
I need to get today's items from database (more specifically PostgreSQL) using JPQL.我需要使用 JPQL 从数据库(更具体地说是 PostgreSQL)中获取今天的项目。
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?问题是我如何只比较一天?
From today means from "00:00:00" until now?从今天开始是指从“00:00:00”到现在?
select u from User u where u.timestamp > date_trunc('day', now());
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.