Hybris灵活的搜索获取记录1小时前创建
我需要一个灵活的搜索查询才能获取从当前日期开始1小时创建的产品,我也尝试了:
select * from {product} where {creationtime} < current_date - INTERVAL 1 HOUR
但是
final FlexibleSearchQuery flexibleSearchQuery = new FlexibleSearchQuery("SELECT {pk} FROM {Product} where {creationtime} < ?inputDate");
flexibleSearchQuery.addQueryParameter("inputDate", ZonedDateTime.now(ZoneId.systemDefault()).toInstant().minus(1, ChronoUnit.HOURS));
,这些解决方案实际上都没有奏效,第一个解决方案是返回1小时间隔所创建的产品但是忽略了实际的日子和月份,看起来它只需要计数时间和几分钟,但忽略了日期。
I need a flexible search query in order to fetch the products created 1 hour ago from current date, I have tried this:
select * from {product} where {creationtime} < current_date - INTERVAL 1 HOUR
Also this:
final FlexibleSearchQuery flexibleSearchQuery = new FlexibleSearchQuery("SELECT {pk} FROM {Product} where {creationtime} < ?inputDate");
flexibleSearchQuery.addQueryParameter("inputDate", ZonedDateTime.now(ZoneId.systemDefault()).toInstant().minus(1, ChronoUnit.HOURS));
However, none of these solutions actually worked, the first one returns the products created in the interval of 1 hour but ignores the actual day and month, looks like it only takes in count the hours and minutes but ignores the dates.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要使用&gt;操作员如下:
不要忘记服务器和应用时区也许有所不同。
You need to use > operator like below:
And don't forget about server and app timezone maybe different.