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

Last change on this file since 180 was 180, checked in by gav, 14 years ago

Add support for taskModification audit/change log, the create and update modifications are complete.
Moved create and update of tasks to taskService.
Small Assset domain class adjustment to prevent blank asset name.
Removed "static scope = 'request'" from services since I don't believe it is required and it limits where the service may be used.

File size: 570 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.