source: trunk/grails-app/services/DateUtilService.groovy @ 137

Last change on this file since 137 was 137, checked in by gav, 10 years ago

Update to grails-1.1.1 release.
Fix WorkDone? and Fault entries not showing after update, now using criteria.
Work on TaskRecurringSchedule, add DateUtilService class, regenerate views to suite.
Finally have correct rollback behaviour on TaskRecurringSchedule? domain object updates by using transactions.
Added name to copyright since the license has no meaning without it.

File size: 566 bytes
Line 
1class DateUtilService {
2
3    boolean transactional = false
4    static scope = "request"
5       
6        public static Date getToday() {
7        return setMidnight(new Date())
8    }
9
10    public static Date getTomorrow() {
11        return (getToday() + 1) as Date
12    }
13
14    public static Date setMidnight(Date theDate) {
15        Calendar cal = Calendar.getInstance()
16        cal.setTime(theDate)
17        cal.set(Calendar.HOUR_OF_DAY, 0)
18        cal.set(Calendar.MINUTE, 0)
19        cal.set(Calendar.SECOND, 0)
20        cal.set(Calendar.MILLISECOND, 0)
21        cal.getTime()
22    }
23
24}
Note: See TracBrowser for help on using the repository browser.