Previous Topic: resetResourceNext Topic: rollTime


rollDate

The rollDate function is used to roll a particular value that is based on a date. For example, perhaps you want to send a feedback email one day after a service desk request was closed. In that case, to write the automation logic, use this function.

When this function is executed, the value num is added to the date dt based on the type.

Syntax

dtRollDate = rollDate(dt, num, type)

Arguments

dt (java.util.Date)

Specifies the date object that is based on the rolling to take place.

num (Int)

Specifies the value that must be rolled.

type (String)

Specifies the one of the following values:

Return Value

dtRollDate (java.util.Date)

Examples

  1. Returns the date which is two days from today.
    dtRollDate = rollDate(today(),2,'d')
    
  2. Returns the next year from today; for example, if today is November 12, 2009, this example will return January 1, 2010.
    dtRollDate = rollDate(today(),1 'y')
    
  3. Returns the first day of the previous week.
    dtRollDate = rollDate(today(), -1,'w')
    
  4. Returns the first day of the previous month.
    dtRollDate = rollDate(today(),-1 ,'m')