Add or subtract hour, day to DateTime power automate
While designing a business process automation sometimes we need to add or subtract an hour, day, or second to DateTime.
Let’s take an example of processing data in a file and the bot needs to check if the date is today then add a day to that input and process it else subtract a day and process it.
In this article, we look at how to achieve this task using Power Automate Desktop.
Let’s get into the practical implementation of this task:
Step1: Drag and Drop Get current date and time action from flow designer from actions panel to the flow designer panel as shown below:

For more information about Get current date and time action refer to the article below:
Now we have today’s date in the CurrentDateTime variable and we will add and subtract a day from this variable.
Step2: Drag and Drop Add to datetime action from actions panel to the flow designer panel as shown below:
Now we will see how to add days to the current DateTime.

Here:
- Datetime – Provide the DateTime variable that you are adding or subtracting the day, hour, second.
- Add – Provide an integer value to add (7) or subtract (-7)
- Time unit – There are different time units to use in this action they are stated below:
- Seconds
- Minutes
- Hours
- Days
- Months
- Years
Step3: The output of the above action is shown below:

Step4: Drag and Drop Add to datetime action from actions panel to the flow designer panel as shown below:
Now we will see how to subtract days to the current DateTime.

- Datetime – Provide the DateTime variable that you are adding or subtracting the day, hour, second.
- Add – Provide an integer value to add (7) or subtract (-7)
- Time unit – There are different time units to use in this action they are stated above:
Step3: The output of the above action is shown below:
