How to Add Days to Date in Power Automate?

In Power Automate, the addDays function lets you quickly add days to a date. This function allows you to adjust dates for various scenarios, such as setting future deadlines or scheduling reminders.

In this tutorial, I will explain how to add days to Date in Power Automate using different scenarios like:

  • Add Days to Date Column in Power Automate
  • Add Two days to date in Power Automate
  • Add Days to Today in Power Automate
  • Add Working Days to Date in Power Automate

Power Automate addDays Function

In Power Automate, the addDays function adds or subtracts a specific number of days to a date. It can be helpful in scenarios where you need to calculate future or past dates based on a given date. Here’s the syntax and usage of the addDays function:

Syntax:

addDays('<timestamp>', <days>, '<format>'?)
  • <timestamp>: The starting date from which the days will be added or subtracted. It must be in a valid date format like ‘yyyy-MM-dd’.
  • <days>: The number of days to add. Use a positive number to add days or a negative number to subtract days.
  • <format> (optional): Specifies the format of the resulting date. If omitted, the result will be in ISO 8601 format.

Add Days to Date Column in Power Automate

For this example, I have a SharePoint list named Event Details that contains information about various events.

add days to date power automate

Now, I want to calculate the Event End Date by adding two days to the Event Date and storing this new date in the Event End Date column.

To do this, follow the below steps:

1. In the Power Automate, click the Instant Cloud flow, enter the Flow name, and choose the trigger flow (i.e., manually trigger a flow).

power automate add days to date

2. Now I need to use the get items action to retrieve all the items in the SharePoint List using the below parameters:

  • Site Address: Provide a specific site address from the drop-down.
  • List Name: Select a specific list from the drop-down.
add days in power automate

3. Then add an update item action to update the Event End Date using the below parameters:

  • Site Address: Provide a specific site address from the drop-down.
  • List Name: Select a specific list from the drop-down.
  • Id: Provide an ID from dynamic content to get items.
  • Event End Date: Provide the below expression:
addDays(item()?['EventDate'],2)
power automate add days

Now, click Save and run the flow manually after it runs successfully. Go to the SharePoint list to see that the event end date has been updated successfully.

Add Days to Date Column in Power Automate

This way, you can add days to the date column using Power Automate.

Add Two days to date in Power Automate

In this example, we will use Power Automate to add two days to date.

1. In the Power Automate, click the Instant Cloud flow, enter the Flow name, and choose the trigger flow (i.e., manually trigger a flow).

power automate add days to date

2. Click the Manually trigger a flow and add a date input like the screenshot below.

Power Automate date add 1 day

3. Add a Compose action and provide the below expression:

addDays(triggerBody()?['date'],2,'dd-MM-yyyy')
  • addDays(): This is a Power Automate function that adds a specified number of days to a given date.
  • utcNow(): This function retrieves the current date and time in UTC (Coordinated Universal Time).
  • 2: This is the number of days you want to add to the current date.
  • dd-MM-yyyy: This is the date format I want.
power automate current date plus 7 days

Now, click Save and run the flow manually. Then, provide a date (for example, I provided 2024-10-25), and click Run flow.

power automate adddays function

After the flow runs successfully, click the compose action. The date is now 27-10-2024.

add days power automate

You can add seven days or any number of days to the date. The only difference is that you need to replace <days> in the formula.

Add Days to Today in Power Automate

Now, I will tell you how to add days to the date in Power Automate. I needed to calculate a future date by adding three days to the current date.

Follow the below steps:

1. In the Power Automate, click the Instant Cloud flow, enter the Flow name, and choose the trigger flow (i.e., manually trigger a flow).

power automate add days to date

2. Add a Compose action and provide the below expression:

addDays(utcNow(), 3,'dd/MM/yyyy')
  • addDays(): This is a Power Automate function that adds a specified number of days to a given date.
  • utcNow(): This function retrieves the current date and time in UTC (Coordinated Universal Time). It returns the current date and time when the flow is executed.
  • 3: This is the number of days you want to add to the current date.
  • dd/MM/yyyy: This is the date format I want.
add days to date in power automate

Now, click Save and run the flow manually after the flow runs successfully.

adddays power automate

Then click on compose action, and you can see that my can date is 17/10/2024, three days from today’s date.

Add Days to Date using Power Automate

Add Working Days to Date in Power Automate

When you add days to a date in Power Automate, it just counts all the days, including weekends. But in real life, you care about weekends. If you have a task that takes ten working days, you expect it to take two weeks, not just ten calendar days.

So, if today is Monday and you want to add ten working days, you should get a date that is two Fridays from now. This way, you account for the weekends and better understand when the task will be done.

To do this, follow the below steps:

1. In Power Automate, click Instant Cloud flow, enter the Flow name, and choose the trigger flow (i.e., manually trigger a flow). Then, click + Add an input to add two inputs: one for the starting date and another for the number.

Add working days to a date in a Power Automate Flow

2. Add select action and provide below parameters:

  • From: Put the below parameters:
range(0,365)
  • Map: Provide the below parameters:
Date : formatDateTime(addDays(triggerBody()?['date'],item()), 'yyyy-MM-dd')
Day   : dayOfWeek(addDays(triggerBody()?['date'],item()))
Power Automate add days excluding weekends

range(0, 365): This creates a list of numbers from 0 to 364. Each number represents a day in the year, with 0 being today and 364 being one year from today.

Date: For each number (or day) in the list, it takes a starting date (provided in triggerBody()?[‘date’]), adds that number of days to it, and then formats the new date in the ‘yyyy-MM-dd’ style (like 2024-10-17).

Day: It gives a number from 0 (Sunday) to 6 (Saturday), representing the day of the week.

3. Now I need to add a filter array action that removes Sunday and Saturday from the selection using the below parameters:

  • From: Provide the output of the select action.
  • Filter Query: Provide the below expression:
and(not(equals(item()['day'], 0)), not(equals(item()['day'], 6)))
How to add only working days to a date using Power Automate

4. At the last, add a Compose action and provide the below expression:

body('Filter_array')[triggerBody()?['number']]['date']
Add working days to a date in Power Automate

Now save the flow and run the flow manually. Then, provide a date and number (for example, I provided 2024-10-17 and number 2), and click the Run flow button.

Power Automate Calculating Working Days

After the flow runs successfully, click the compose action. The date is now 2024-10-21.

Add Working Days to Date in Power Automate

This tutorial explored the addDays function in Power Automate, which allows you to add or subtract days from a given date. We covered various scenarios, such as calculating an Event End Date by adding days to an Event Date in a SharePoint list, as well as adding days to a user-provided date and to today’s date.

Additionally, we discussed how to account for weekends when adding working days to a date by using the Filter array action to exclude Saturdays and Sundays.

Related Power Automate articles:

  • I have built a child flow that can add/subtract days excluding weekends and holidays. You can download the solution from my google drive https://drive.google.com/drive/folders/1HEVagrAcCfRlcK6PYTIMsj-bYH10zdyh. Also, you can check how it works here https://youtu.be/zPKEGT03AZE.

    If you need o customize holidays or your working week starts from Sunday, just update the “Configuration” variable.

  • >

    Build a High-Performance Project Management Site in SharePoint Online

    User registration Power Apps canvas app

    DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

    Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

    Power Platform Tutorial FREE PDF Download

    FREE Power Platform Tutorial PDF

    Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…