groovy - Get all records by date ignoring the time in DateTime in grails -
i'm using grails joda date time plugin want fetch record day ignoring time precision in date. whats best way it?
thanks help.
class record { datetime datefield def getallrecordsforoneday(aday = new datetime()) { def localdate = new localdate(aday); record.findalldatefieldbetween(localdate.todatetimeatstartofday(), localdate.plusdays(1).todatetimeatstartofday()) //or criteria record.withcriteria { between 'datefield', localdate.todatetimeatstartofday(), localdate.plusdays(1).todatetimeatstartofday() } } }
Comments
Post a Comment