Job Runner

Calculate Date

Overview

This Do adds/subtracts days, months, or years relative to a specific date. The calculation result can be referred to in other Actions.

Usage

When you execute an Action set to run “Calculate Date”, the result of that calculation is stored internally. You can calculate the date using a formula, for example, “=$1”. The saved date is formatted so that it can be exported to a “Date” field in Kintone without modifications. However, the saved date does not contain any time data, so it cannot be exported to a “Date and time” field in Kintone.

Example: Re-using the calculated date in an Action that runs the Do “Add New Record.”

  1. First, set an Action that runs the Do “Calculate Date.” Assume that the Action Number is “1.”
  2. Next, open the “Mapping” menu of “Add New Record”, find the “Date” field that should receive the calculated date and enter the formula “=$1.” (If the Action Number of “Calculate Date” is “2”, change the formula to “=$2”.)

Parameters

Set Base Date, Right Hand Side Value, and Calculate Type.

Base Date

Enter the start date to be used in the date calculation.

If you want to access the value of a “Date” field or a “Date and time” field, input the field code as shown in the example below:

=Date_2

Remember to use an equals sign (=) before the field code to access the value of that field.

Use the syntax below if you want to use the current date.

=today()

This will set the current date/time as the value of this parameter.

Values that cannot be interpreted as empty values or dates cause an error at runtime.

Right Hand Side Value

Set this parameter to an integer value. This represents the number of days/months/years that the Do should add to the base date.

For example, if you want to add three months to the base date, click the “Calculate Type” parameter, select “X Months After” in the menu and then input the value “3” in the “Right Hand Side Value” parameter.

You can also use negative values. For example, if you set “Right Hand Side Value” to “-3” and “Calculate Type” to “X Months After,” the Do will return the date three months before the base date.

An empty value causes an error at runtime. A value of zero means no error.

Calculate Type

The following date calculations are available: “X Days After,” “X Weeks After,” “X Months After,” “First of Month After X Months,” “End of Month After X Months,” and “X Years After.”

関連記事