Create a Complex Date Calculation
To create a complex date calculation, do the procedure in this topic.
Good to Know
- In most text fields, you can use process data variables as an alternative to literal data values.
- You can configure whether this activity waits for other activities before it runs.
For more information, refer to How Do I Configure an Activity to Wait for Other Incoming Activities?
How to Start
- Open Process Builder.
For information about how to open this screen, refer to Process Builder.
- Do one of these:
- Click Calculate Date Difference .
Procedure
- On the Calculate Date Difference screen on the Input tab, complete this field
as necessary.
Field Name Value Input Date Time
- Description:
- Specifies the reference date for your date calculation.
Two Date Time fields are available: Input Date Time 1 and Input Date Time 2.
- Allowed Values:
-
- Custom Attributes - Specifies a process data variable that stores the date-time value and your date-time format.
You can use App Data screen to specify a process data variable.
You can also use a custom date-time format. For more information, refer to Customize Your Date-Time Format.
- Static - Specifies a static date and time.
- Now - The date and time the system activity starts at runtime.
- Custom Attributes - Specifies a process data variable that stores the date-time value and your date-time format.
- Default Value:
- Custom Attributes
- Example:
- Refer to:
- Click the Operation tab.
- On the Operation tab, select Calculate Difference, and complete these fields
as necessary.
Field Name Value Compare Difference
- Description:
- Specifies how to compare the difference between the two Input Date Time values.
- Allowed Values:
-
- The operator used to compare the two Input Date Time values:
- <= - Less than or equal to.
- >= - Greater than or equal to.
- = - Equals
- <> - Not equal to.
- An integer, or a process data variable that stores an integer.
You can use App Data screen to specify a process data variable.
- The time unit.
Options are:
- Seconds
- Minutes
- Hours
- Days
- Weeks
- Months
- Years
- The operator used to compare the two Input Date Time values:
- Default Value:
- None
- Accepts Variables:
- Yes
Calculation Type
- Description:
- Specifies how the difference between the Input Date Time 1 and Input Date Time 2 is calculated.
- Allowed Values:
- Real - The actual difference between the two DateTime values. The result depends upon the option set in the Result field.
- Relative - The relative difference between the two DateTime values. This setting is useful for situations when an action is allowed, for example, once per week or once per month.
- Default Value:
- Real
- Example:
- The difference between the dates
Sat 29-Dec-2007 23:50:00 and Wed 02-Jan-2008 00:00:00
is calculated as follows. Note that these dates are 4 days apart,
but occur in different years, different months, and
different weeks.
- When you select the Real option the difference is calculated based on the actual number of days (and hours and minutes) between the two dates: 4 days and 10 minutes.
- When you select the Relative option, the difference is 4 days, 1 week or 1 month, or 1 year, depending upon the time unit specified.
- Click the Output tab.
- On the Output tab, complete these fields
as necessary.
Field Name Value Result Boolean
- Description:
- Specifies the name of the variable that stores the Boolean result returned from the Compare Difference date calculations.
If the Compare Difference option is enabled, the difference is evaluated as a Boolean result, and the Boolean value is associated with the variable that appears in this field.
- Allowed Values:
- A process data variable that stores a Boolean Date Time result.
- Default Value:
- None
- Accepts Variables:
- Yes
Date String
- Description:
- Specifies the process data variable that stores the result received from the date calculations if it is in the Date Time format.
The results of the date calculations that changes from the Date Time format to a String. The format of the string is specified in the list.
- Allowed Values:
- A process data variable that stores the result in the selected String format.
- Default Value:
- None
- Accepts Variables:
- Yes
- Example:
- Refer to:
Difference
- Description:
- Specifies the result returned from the Compare Difference date calculations.
In terms of a number of time units, such as 5 seconds, or 10 days.
If Compare Difference is enabled, the difference is stored as a variable with the name that appears in this field. The value is the output value of the comparison.
- Allowed Values:
-
- A process data variable that stores the value of the comparison result.
- The time unit.
Options are:
- Seconds
- Minutes
- Hours
- Days
- Weeks
- Months
- Years
- Default Value:
-
- None
- Days
- Accepts Variables:
- Yes
Result
- Description:
- Specifies the type of value to return for the date calculations where the Calculation Type is set as Real.
- Allowed Values:
- Decimal - Returns the difference as is, including any decimals.
- Whole Number - Returns the integer part of the result by removing the decimal part.
- Rounded - Rounds up (>=0.5) or rounds down (<0.5) the result.
- Default Value:
- None