subtractFromTime function(Power Automate Cloud flows)

Japanese version.

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>')
timestampRequired fieldSpecify the date and time of the calculation source.
intervalRequired fieldSpecifies 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.
timeUnitRequired fieldSpecify the unit of measure for the calculation.
formatyyyy-MM-ddTHH:mm:ss.fffffffKSpecifies 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.

Specify arguments.

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.

For those who want to learn Power Automate Cloud flow effectively

The information on this site is now available in an easy-to-read e-book format.

Or Kindle Unlimited (unlimited reading).

You willl discover how to about basic operations.

By the end of this book, you will be equipped with the knowledge you need to use Power Automate Cloud flow to streamline your workflow.


Date and time Functions(Power Automate Cloud flows)