getPastTime function(Power Automate Cloud flows)
Subtract(calculate past date) from the current date and time (time zone is UTC) in the specified unit.
Units can be selected from year, month, week, day, hour, minute, and second.
It is similar to subtractFromTime function, but there is a difference between calculating from the specified date and time or from the current date and time.
This function is the reverse of getFutureTime and the positive and negative of the calculation.
Spec
getPastTime(<interval>, '<timeUnit>', '<format>')
Argument | Default | Description |
---|---|---|
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. Year,Month,Week,Day,Hour,Minute,Second |
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, getPastTime, 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, getPastTime(1, 'Day'), The day before the execution date and time (time zone is UTC) will be the result.
If you want to change the format of the result, specify the format in the third argument.
If you specify a negative number for the first argument, it will be addition(calculated to the future date and time), but since the expression is complicated, use getFutureTime.
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.
Discussion
New Comments
No comments yet. Be the first one!