Subtract (calculate past dates) from the specified date and time in the specified unit.
The addToTime function is the opposite of the positive and negative of the calculation.
Units can be selected from year, month, week, day, hour, minute, and second.
However, since addToTime function is easier to understand and is the same as Excel and other calculation methods, it is acceptable to use addToTime instead of subtractFromTime.
subtractFromTime('<timestamp>', <interval>, '<timeUnit>', '<format>')
|timestamp||Required field||Specify the date and time of the calculation source.|
|interval||Required field||Specifies the amount by which the date/time is to be moved.|
Positive values calculate in the past direction; negative values calculate in the future direction.
|timeUnit||Required field||Specify the unit of measure for the calculation.|
|format||yyyy-MM-ddTHH:mm:ss.fffffffK||Specifies the format of the result.|
How to use
In most cases, it is used in the "value" when initializing or setting variables of type "string".
Click on the "Expression" tab, subtractFromTime, and the function name and () will be set in the expression field.
The first argument is the date, the second is the amount to be moved, and the third is the unit.
When using dynamic content or variables, special specifications are required.
Click on the button, and if the display looks like the following, the setting is complete.
You can change the function by clicking this purple icon.
For example, subtractFromTime('2022-05-15', 1, 'Day'), The result will be May 14, 2022, one day later.
If you want to change the format of the result, specify the format in the fourth argument.
subtractFromTime('2022/05/15 13:30:45', 1, 'Day', 'yyyyMMddHHmmss')
A negative value for the second argument results in a date in the future.
However, since multiplication of negative numbers is difficult to understand, the use of addToTime function is recommended.