Changeset 553 for trunk/grails-app/services/DateUtilService.groovy
- Timestamp:
- May 31, 2010, 1:54:53 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/services/DateUtilService.groovy
r552 r553 77 77 78 78 /** 79 * Get the date one month in the future. 80 * @param date The Date object to start with. 81 * @returns A Date object one month in the future. 79 * Get the date plus x weeks. 80 * @param date The Date object to start with, defaults to today. 81 * @param plusYears The number of weeks to add, defaults to 1. 82 * @returns A Date object adjusted by x weeks. 82 83 */ 83 public static Date getNextMonth(Date date) {84 public static Date plusWeek(Date date = new Date(), Integer plusWeeks = 1) { 84 85 use(TimeCategory) { 85 date + 1.months86 date + plusWeeks.weeks 86 87 } 87 88 } 88 89 89 90 /** 90 * Get the date one month ago. 91 * @param date The Date object to start with. 92 * @returns A Date object one month ago. 91 * Get the date plus x months. 92 * @param date The Date object to start with, defaults to today. 93 * @param plusYears The number of months to add, defaults to 1. 94 * @returns A Date object adjusted by x months. 93 95 */ 94 public static Date getPreviousMonth(Date date) {96 public static Date plusMonth(Date date = new Date(), Integer plusMonths = 1) { 95 97 use(TimeCategory) { 96 date - 1.months98 date + plusMonths.months 97 99 } 98 100 } … … 133 135 * @returns An integer representing the day of the month. 134 136 */ 135 public static Integer getDay FromDate(Date date) {137 public static Integer getDayOfMonthFromDate(Date date) { 136 138 Calendar cal = Calendar.instance 137 139 cal.setTime(date)
Note: See TracChangeset
for help on using the changeset viewer.