Power Automate add days to date

In this Power Automate Tutorial, we will learn about the Power Automate addDays() function and how to use this function in Power Automate flow or Microsoft flow. Also, we will discuss these below topics apart from an example on Power Automate add days to date:

  • Power Automate add days function
  • Power Automate add days to date column
  • Power Automate add days to date format
  • Power Automate add days to date variable
  • Power Automate add days to due date
  • Power Automate add days to current date
  • Power Automate add business days to date
  • Power Automate add 365 days to date
  • Power Automate add days to utcnow

Power Automate add days function

In Power Automate there are a function ‘addDays()‘ under the Date and time that required a string that contains the time. It adds an integer number of days to a string timestamp passed in.

For this function, the syntax is:

addDays(timestamp: string, days: integer, format?: string)

Where,

  • timestamp – It requires a DateTime in string format.
  • days – It requires an integer that will add days to the given date.
  • format – It convert the DateTime into a specified format (i.e. dd-MM-yyyy, dd-MMMM-yyyy,etc)

Example of addDays()

To implement this, let’s create a flow where we will insert a date and add 5 days to that inserted date. The following steps are:

Before we will create a flow, make sure to sign in the Power Automate using the Microsoft account. Then click on +Create > Instant cloud flow > Manually trigger a flow.

Step-1:

Now our flow is triggered. In that trigger, we will add a date input.

Click on +Add an input > Date.

Power Automate add days function
Power Automate add days function

Step-2:

Next, we will add an expression using addDays() in the Compose action, that will add a specified integer (days) to the given dates. Then click on update.

Click on +New step > Compose > Expression.

addDays(triggerBody()['date'],5,'dd-MM-yyyy')
Power Automate add days function example
Power Automate add days function example

Now Save the flow to test. It will ask to insert a date. For example, we will insert 12/15/2021. Click on Run flow.

As a result, it will return a date i.e. 12/15/2021 + 5 = 12/20/2021.

Example of Power Automate addDays() function
Example of Power Automate addDays() function

This is how the addDays() function works on Power Automate.

Check out, Power Automate Increment Variable + 11 Examples

Power Automate add days to date

Here we will see how to add days to a date column in the SharePoint list automatically using Power Automate.

For this, here we have created a SharePoint list based on the Project’s delivery reports having columns such as; Title, Project Manager(People column), Start date & DueDate(DateTime column), TaskStatus(Choice).

Power Automate add days to date
Power Automate add days to date

Now we will create a flow, when we will insert the start Date with project details, it will auto-update its Delivery Date by adding specific days into it. Make sure that the delivery date should become after 8 days of the start date.

To implement this scenario, the following steps are:

Step-1:

First, we will add the trigger ‘When an item is created in Power Automate. Set the Parameter according to your Site Address and List Name.

Power Automate adddays to date in SharePoint
Power Automate add days to date in SharePoint

Step-2:

Next, we will add an expression using Compose action, that will calculate the delivery date by adding 8 days(as per our scenario) to the Start date.

Click on +New step > Compose action > Expression.

addDays(triggerOutputs()?['body/StartDate'],8,'MM-dd-yyyy')
Power Automate add days to date column
Power Automate add days to date column

Step-3:

Then we will add another action to update the delivery date in SharePoint. Set the Properties like below:

  • Site Address– (As peryour SharePoint Address)
  • List Name- Your specific list name i.e. Projects
  • id– ID(from when item is created in SharePoint)
  • Title– Title( from when item is created in SharePoint)
  • ProjectManager- ProjectManager claims(from when item is created in SharePoint)
  • StartDate– Startdate(from when item is created in SharePoint)
  • TaskStatus – TaskStatusValue(from when item is created in SharePoint)
  • DeliveryDate– Output of Compose

Click on +New step > Update item > add it.

Power Automate add days to date column in SharePoint
Power Automate add days to date column in SharePoint

Let’s run the flow by inserting the data except for the Delivery date. For example, let’s insert 13/12/2021 as a start date in the SharePoint list.

 add days to date in Power Automate
add days to date in Power Automate

It will auto-update the Delivery date by adding 8 days to the start date.

Adding Days to Datetime field using Microsoft Flow
Adding Days to Datetime field using Microsoft Flow

This is how to add Days to the Datetime field using Microsoft Flow.

Read Power Automate SharePoint Get items filter query contains is not valid

Power Automate add days to date format

Here we will see how to format the date in the addDays() function in Power Automate.

It allows formatting the date as:

Format Example
dd-MM-yyyy 13-12-2021
dd-MMMM-yyyy 13-December-2021
dd-MMM-yyyy 13-Dec-2021
dd-MM-yy 13-12-21
MM-dd-yyyy 12-13-2021

Let’s take an example, that will execute the date in ‘dd-MMMM-yyyy’ format in the addDays() expression.

For this, here we will start the flow by triggering it manually, using a date input inside the trigger(as we have triggered in the previous example).

Then we will add a Compose action to calculate the date using add days expression:

addDays(triggerBody()['date'],10,'dd-MMMM-yyyy')

It will add 10 days to the inserted data.

Power Automate add days to date format
Power Automate add days to date format

Let’s run this flow to see the date in the given format.

Add days to date format in Power Automate
Add days to date format in Power Automate

This is how to do Power Automate add days to date format.

Read Power Automate copy list item to another list with attachments

Power Automate add days to date variable

Here we will see how to add days to a date variable using Power Automate.

First, we will trigger the flow manually by using date input. Then we will add an action to initialize a string variable using this triggered date.

Click on +New step > Initialize variable. Set the parameters like below:

  • Name– VarDate
  • Type– String
  • Value– @{triggerBody()[‘date’]}
Power Automate add days to date variable
Power Automate add days to a date variable

Next, we will use an expression in a Compose action to add days in the date Variable i.e. VarDate.

Click on +New step > Compose > Add it.

addDays(variables('VarDate'),3,'dd-MMM-yyyy')

Here we have added 3 days to the date variable.

Add days to date variable in Power Automate
Add days to date variable in Power Automate

Let’s insert a date and run the flow to see how the date comes with additional days.

add days to date variable Microsoft flow
add days to date variable Microsoft flow

As we inserted the date 2021-12-14, so it came 17-Dec-2021 by adding 3 days. This is how to add days in a date variable in Power Automate.

Check out, Power Automate save email attachment to SharePoint

Power Automate add days to current date

Here we will see how to add days to the current date using Power Automate flow.

Let’s start the flow by triggering it manually. Then we will add a Compose action using an expression that will show the current date.

Click on +New step > Compose > Expression > Update.

utcNow()
Power Automate add days to current date
Power Automate add days to the current date

Next, we will add another Compose action using an expression that will execute the date by adding days to the current date.

Click on +New step > Compose > Expression.

addDays(outputs('Compose'), 15, 'dd-MM-yyyy')

Here we have added 15 days to the current date.

Add days to time stamp in Power Automate
Add days to the time stamp in Power Automate

Let’s run the flow manually to see the result date. As the current date is 14/12/2021 so it will come by adding 15 days i.e. 29/12/2021.

Power Automate add days to utcnow
Power Automate add days to utcnow

This is how to add days to the current date using Flow.

Read Power Automate get items examples

Power Automate add days to due date

Let’s see how to add days to the due date using Power Automate flow. For example, we are going to use a list template from SharePoint i.e. Work progress tracker.

On SharePoint > Create list > Work progress tracker > use template.

Power Automate add days to due date
Power Automate add days to the due date

The list will represent like this:

Add days to due date in Power Automate
Add days to the due date in Power Automate

Let’s create a flow to add days to the due date in the SharePoint list. Go to Power Automate and select the trigger when an item is created. Here we have to set the site address and the list name.

Add days to due date using flow
Add days to due date using flow

Next, we will use a compose action using an expression that will add 2 days to the due date(that we will insert).

Click on +New step > Compose > Expression.

addDays(triggerOutputs()?['body/DueDate'],2,'MM-dd-yyyy')
Add 2 days to date in Power Automate
Add 2 days to date in Power Automate

Then we will add an action to update the due date in sharepoint list. Make sure update the due date with the output of compose.

  • Due Date- @{outputs(‘Compose’)}

Click on +New step > Update item.

Add 2 days to due date in Power Automate.png
Add 2 days to due date in Power Automate.png

Let’s run the flow manually and insert a data into the SharePoint list:

Power Automate add days to the due date
Power Automate add days to the due date

After refreshing the page, we can see the due date got updated by adding 2 days i.e. 12/20/2021.

Power Automate add 2 days to date
Power Automate add 2 days to date

This is how to add days to the due day in SharePoint using Power Automate.

Also read, Power Automate vs UiPath

Power Automate add 365 days to date

Now we will see how to add 365 days to a random date using Power Automate.

Let’s start the flow manually using a date input where we can insert any dynamic date. (Please check the previous example to trigger the flow manually).

Then we will use a Compose action using an expression tha will add 365 days to the inserted date.

Click on +New step > Compose > Expression.

addDays(triggerBody()['date'], 365, 'dd-MM-yyyy')
Power Automate add 365 days to date
Power Automate add 365 days to date

Let’s save the flow for testing. It will ask to insert the date before running. For example we will insert current date i.e. 14/12/2021.

Power Automate add 365 days to the date
Power Automate add 365 days to the date

Click on the Run flow to see the run and see the date as well. As a result it will come by adding 356 to 4/12/2021 i.e. 14/12/2022.

add 365 days to date Power Automate
add 365 days to date Power Automate

This is how to add 365 days to date using Power Automate.

Read Power Automate conversion of string

Power Automate add business days to date

Here we will see how to add business days to a given date. Also, it will exclude the weekends i.e. Saturday and Sunday.

For example, If we insert today’s date i.e. 12/14/2021, and want to add 4 days, then it should come 12/20/2021. As it is excluded 2 weekends i.e. Saturday and Sunday. Let’s create a flow to implement this and the following steps are:

Step-1:

First, we will start our flow by triggering it manually. Next, we will add a Compose action where we will set an integer value that indicates how many days we want to add for calculating the business days.

For example, we want to add 4 business days to the date. Click on +New step > Compose.

Power Automate add business days to date
Power Automate add business days to date

Step-2:

Next, we will add an action to initialize a sting variable using a DateTime. Here we are going to use current date so that it will add 4 business days from this date i.e. 2021/12/14.

Click on +New step > Initialize Variable. Set the parameters like below:

  • Name- VarDate
  • Type- String
  • Value- 2021-12-14
Add business days to date using Power Automate
Add business days to date using Power Automate

Again we will add an action to initialize an integer variable. Click on +New step > Initialize variable and set the properties like below:

  • Name- VarNumber
  • Type- Integer
  • Value- 0
How to add business days to date Power Automate
How to add business days to date Power Automate

Step-3:

Next, we will add do-until condition control that will run the flow till the condition meet i.e. VarNumber is equal to addDays(0 to 4).

Click on +New step > condition > do-until. Set the properties like:

  • Value- VarNumber
  • Condition- is equal to
  • Value- outputs(‘AddDays’)
Add working days to a Date in Power Automate
Add working days to a Date in Power Automate

Step-4:

Next, we will add a Compose action inside this do-until condition that will contain the date variable i.e. VarDate.

Also, under this Compose again we will add an action to set the variable. Here we will set the properties like:

  • Name- VarDate(from initialized variable)
  • Value- use the below expression
addDays(outputs('Compose_2'),1)
Calculating Business days using flows
Calculating Business days using flows

Step-5:

Under this set variable action, we will add a condition action that will check the days should not contain Saturday and Sunday.

Click on +add an action > Condition.

Here we will use an expression that will check whether it is not equal to 0 and 6(for Sunday and Saturday respectively).

dayOfWeek(variables('VarDate'))
Add business days to date in Power Automate
Add business days to date in Power Automate

If the condition met, then it will increment the variable i.e. VarNumber. In If-yes, click on +Add an action > Increment variable. Set the properties like below:

  • Name– VarNumber
  • Value– 1
Add business days to time stamp in Power Automate
Add business days to time stamp in Power Automate

Step-6:

Finally, we will add a Compose action (outside the do-until control) using the date variable that we had created i.e. VarDate.

Power Automate Adding Business days to a date
Power Automate Adding Business days to a date

Now our flow is ready to test and run. Let’s save this flow and click on test manually.

Calculating working days in Power Automate
Calculating working days in Power Automate

This is how we can add days to the business days using Power Automate.

You may also like the following Power Automate tutorials:

Conclusion

From this Power Automate Tutorial, we learned all about the addDays() function using inflow. Also, we discussed the below topics:

  • How to use Power Automate add days function?
  • How to add days to the date column in SharePoint using Power Automate?
  • How to do date format using Power Automate add days?
  • How to add days to date variable in Power Automate?
  • How to add days to the current date using Microsoft flow?
  • How to add days to due date in SharePoint using flow?
  • How to add 365 days to any dynamic date using Power Automate?
  • How to add business days or work days using Power Automate?
  • Thanks for the great tutorial. I tried to capture a date value from a SharePoint list, add 7 days to it and write the result back to a new item in the list. So I did exactly as you described it.
    PA doesn’t let me create the new item, though. It tells me it expects a “String/date” value which the composed value apparently doesn’t have. Any ideas?

  • >