Date subtraction
Power Automate Desktop has an action called "Date Subtraction", but the actual processing converts the difference in two datetime
variables to any unit, so that it goes back to the specified period from a specific date.It cannot be used as a process.
Here, we will explain how to subtract the acquired date data on a day, month, and annual basis.
Conclusion
This time, we use the action called "additional date".
It is named "addition", but you can express subtraction by adding a negative value.
There is also an action called "Date Subscription", but this is an action that strictly acquires the difference between two dates.
Details of "Date to add" action
The action has the following parameters.
Parameter name | value |
---|---|
date | PDF file path to be extracted as an image |
Addition | The number to be added (If you choose an old for "time units") |
Time unit | Units to be added (year, month, day, etc.) |
implemented with copy and paste
This time, as a sample, we have prepared a flow to calculate the current date and calculate 10 days before him.
Copy the following code and paste it on the edit screen of Power Automate Desktop to add the target action.
DateTime.GetCurrentDateTime.Local DateTimeFormat: DateTime.DateTimeFormat.DateAndTime CurrentDateTime=> CurrentDateTime
DateTime.Add DateTime: CurrentDateTime TimeToAdd: -10 TimeUnit: DateTime.TimeUnit.Days ResultedDate=> ResultedDate
DateTime.Subtract FromDate: CurrentDateTime SubstractDate: ResultedDate TimeUnit: DateTime.DifferenceTimeUnit.Days TimeDifference=> TimeDifference
Operate and implement Power Automate Desktop
Enter "Additional date" from "Action Search".
Set the parameter as follows
Parameter name value date %CurrentDateTime% Addition -10 Time unit Day By execution, the date data 10 days before the specified date is stored in a new variable.
The exception that can occur
There is no exception from this action.