Hi,
I have a domain class in my Grails app that looks like this:
class Event {
Date date
}
I want to write a criteria query that selects events that occurred in a certain month of a certain year, any suggestions?
Thanks, Don
Hi,
I have a domain class in my Grails app that looks like this:
class Event {
Date date
}
I want to write a criteria query that selects events that occurred in a certain month of a certain year, any suggestions?
Thanks, Don
You could probably just use between
:
def firstDayOfMonthInYear, lastDayOfMonthInYear;
/* set the two values using Calendar or some other mechanism */
Event.withCriteria {
between('date', firstDayOfMonthInYear, lastDayOfMonthInYear)
}
I'm not certain of the inclusivity of between
- you may need to adjust your start/end dates if it's not inclusive on both ends.