Method Signature
| Description
| Example
|
---|
plusHours( Date date, Int value)
| Add hours to the date field.
| def now = new Date();
def nextDay = plusHours(now, 24);
return nextDay; //returns the value of now increased by a duration of 24 hours since the initial value of now
|
plusDays( Date date, Int value)
| Add days to the date field.
| def now = new Date();
def nextDay = plusDays(now, 1);
return nextDay //returns the value of now increased by a duration of one day since the initial value of now
|
plusWeeks( Date date, Int value)
| Add weeks to the date field.
| def now = new Date();
def nextWeek = plusWeeks(now, 1);
return nextWeek; //returns the value of now increased by a duration of one week since the initial value of now
|
plusMonths( Date date, Int value)
| Add months to the date field.
| def now = new Date();
def nextMonth = plusMonths(now, 1);
return nextMonth; //returns the value of now increased by a duration of one month since the initial value of now
|
plusYears( Date date, Int value)
| Add years to the date field.
| def now = new Date();
def nextYear = plusYears(now, 1);
return nextYear; //returns the value of now increased by a duration of one year since the initial value of now
|
minusHours( Date date, Int value)
| Subtract hours from the date field.
| def now = new Date();
def yesterday = minusHours(now, 24);
return yesterday; // returns the value of now decreased by a duration of 24 hours since the initial value of now
|
minusDays( Date date, Int value)
| Subtract days from the date field.
| def now = new Date();
def yesterday = minusDays(now, 1);
return yesterday; //returns the value of now decreased by a duration of one day since the initial value of now
|
minusWeeks( Date date, Int value)
| Subtract weeks from the date field.
| def now = new Date();
def lastWeek = minusWeeks(now, 1);
return lastWeek; //returns the value of now decreased by a duration of one week since the initial value of now
|
minusMonths( Date date, Int value)
| Subtract months from the date field.
| def now = new Date();
def lastMonth = minusMonths(now, 1);
return lastMonth; //returns the value of now decreased by a duration of one month since the initial value of now
|
minusYears( Date date, Int value)
| Subtract years from the date field.
| def now = new Date();
def lastYear = minusYears(now, 1);
return lastYear; //returns the value of now decreased by a duration of one year since the initial value of now
|
minusDate(Date dateOne, Date dateTwo)
| Subtract one date from another. Returns the difference in days between the dates passed as arguments. If the second date passed as an argument occurs after the first date argument, the returned value is negative.
| def now = new Date();
def tomorrow = plusHours(now, 24);
return minusDate(now, tomorrow); //returns the difference in number of days between the value of now decreased by the value of tomorrow. In this case -1.0.
|