如何在 from & 的子句之间写作到 grails 中 createCriteria 的日期? [英] How to write between clause for from & to dates for createCriteria in grails?
本文介绍了如何在 from & 的子句之间写作到 grails 中 createCriteria 的日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用以下代码获取 2 个日期之间的结果.
I want to fetch results between 2 dates using following code.
def c = TestCase.createCriteria()
resultss = c.list {
like("testStatus", "Dummy")
and {
between("testTime", date1, date2)
}
order('testified','desc')
}
在这里我想选择从日期和到日期,如下所示
Here I want to select From Date and To Date like below
FROM DATE : '2014-11-07 12:14:03'(date1)
TO DATE : '2015-01-09 08:14:12'(date2)
我尝试了很多,但没有成功让它运行.
I tried a lot but no luck to get it run.
谁能告诉我怎么做?
推荐答案
和
有奇数;首先,无论如何都是默认值.如果你想显式,那么把语句放入 and 块中:
the and
there is odd; first of all and is the default anyway. and if you want to be explicit, then put the statements into the and block:
and {
like("testStatus", "Dummy")
between("testTime", date1, date2)
}
或者只是
like("testStatus", "Dummy")
between("testTime", date1, date2)
这篇关于如何在 from & 的子句之间写作到 grails 中 createCriteria 的日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文