adddays() in Power Automate + Examples

This tutorial explains how to add days to the date while working with Power Automate date and time manipulations and covers a few examples related to the adddays() in Power Automate.

Here, we will discuss the examples like:

  • adddays function in power automate
  • Add 1 day to date in Power Automate
  • Power Automate utcnow add days
  • Add 15 days from today in Power Automate
  • Power Automate add days negative
  • Power Automate add days to date format
  • Power Automate Created plus 7 days
  • Power Automate add days to Sharepoint Date
  • Add year to date in Power Automate
  • Add working days to the date using Power Automare

Power Automate adddays() Function

Power Automate Date and time functions have similar functions that resemble adddays() functions like addHours(), addMinutes(), and addSeconds(). Power Automate adddays() expression is useful for adding a specific number of days to the date or timestamp.

This function can add a positive or negative number of days, where positive numbers will add the number of days, and negative numbers will subtract the number of days.

The result will return the provided date + number of days in a particular format.

Syntax: addDays('timestamp', days, 'format')

This is a simple explanation of the Power Automate adddays() function.

Add 1 Day to Date using Power Automate

Now, let’s check how to add days to a particular date using a Power Automate flow.

Example:

Let’s consider a particular timestamp, ‘19-05-2024‘. I wanted to add one day to this date so that the result will return ‘20-05-2024‘.

Steps:

1. Navigate to https://make.powerautomate.com to open the Power Automate Home page -> Click +Create -> Select ‘Instant cloud flow’ -> In the next window, Provide a flow name & select trigger ‘Manullay trigger a flow’ -> Tap Create button -> Inside the trigger, add a date input.

2. Select the ‘Initialize variable‘ flow action to select the trigger date. Provide a name for a variable, and select the data type and value.

Power Automate add days to date

3. Take a Compose action to give the expression to add days to the triggered date.

Insert the below-placed code in the expression:

addDays(variables('Date'),1,'dd/MM/yyyy')
adddays Power Automate

4. After that, you can save and run the flow manually. In the run flow window, pick a date to which you want to add days -> Click Runflow.

adddays in Power Automate

Output:

Now, you can check that the output of the compose action will return a timestamp by adding one day to the triggered date, as shown below:

Power Automate add 1 day to date

This is how to add a day to the date using the adddays() expression in Power Automate.

See also  Power Automate delete emails older than [15 days example]

Power Automate utcnow() Add Days

To add days to the current date using Power Automate, check out the below example:

Example:

Let us assume the current date is 20-05-2024. My requirement is to add 30 days to the utcnow(), which would result in 20-06-2024.

Follow the same steps mentioned in the above example:

1. In the Initialize variable action, take the utcnow() function that will get the current date and time.

add days in Power Automate

2. Add the below-given expression in Compose action, which will add days to the current date.

addDays(variables('Date'),30,'yyyy MMMM dd')

Note:

If you want to get 15 days from today, use the expression like addDays(utcNow(),15,’yyyy/MMMM/ dd’).
Power Automate utcnow add days

Output:

The flow will give the following result in compose outputs. Refer to the image below:

Power Automate current adddays expression

This way, you can add days to the utcnow() function in Power Automate.

Power Automate Adddays Negative

To know about adding negative days to the timestamp, look at the example below:

Example:

Suppose I take the date variable value ‘01-05-2024‘ and want to add 7 negative days to it. The Power Automate adddays() function will subtract the number of days from the given date and display the resulting date [24 -04-2024].

Steps to do this:

1. Inside the Initialize variable, take the value of the triggered date.

2. In the Compose data operation, insert the expression that will add negative days to the date.

addDays(variables('Date'),-7,'MMMM dd, yyyy')
Power Automate adddays negative

3. Save and run the flow manually. In the Runflow window, pick a date that you want to trigger and click on the Runflow button.

Power Automate add negative days to date

3. You can now check the output, it will show the result as subtracting days from the date.

  • The output will be April 24, 2024.
adddays expression Power Automate

This is about adding negative days to the date using the Power Automate adddays() expression.

Power Automate Add Days to Date Format

In Power Automate, as you all know, we can also format the date in a customized way by using Power Automate to add the days() function other than adding days.

Example:

Let’s take a specific date, ‘2024-05-01′. Now, my requirement is to add two days to this particular date and retrieve the result in a specific format, like Weekday, dd/MM/yyyy [Monday, 01/05/2024].

Now, let’s see how to add days to the date format:

1. In the Compose action, give the expression to add days and change the custom format.

addDays(variables('Date'),2,'dddd, dd/MM/yyyy')
Power Automate add days to date format

2. The image below represents the triggered date with the default format.

Add days to date format Power Automate

Output:

When the flow runs successfully, you can see that the days have been added to the date and displaying in a required format.

add days date format in Power Automate

The table below represents some of the date formats that you can use in Power Automate:

FormatDescriptionOutput
yyyyyear2024
MMMMMonth nameOctober
ddday11
yyyy-MM-ddYear-Month-Day2024-10-12
yyyy-MM-ddTHH:mm:ssZDate and Time2024-10-12T14:30:00Z
dddd, dd/MM/yyyyWeekday,date/Month/YearMonday, 01/05/2024
MM-dd-yyyyMonth-date-year05-20-2024
MMM dd,yyyyMonth Day, YearJan 16, 2024

This is about Power Automate add days to the date format using the adddays() function.

See also  How to Format Number without Decimal in Power Automate?

Power Automate Created Plus 15 Days

Here, let me show another example of Power Automate add days to date.

Example:

I have a SharePoint list named ‘Upcoming Sales Meeting‘ with a few columns, as looked at in the below image:

add days to date in Power Automate

My requirement is to delete the SharePoint list of items that are older than 15 days.

Check out the steps below:

1. Log in to Power Automate, click on Create, select Scheduled cloud flow, and then click on the Create button.

Provide the parameters below:

  • Interval: Enter interval as 1.
  • Frequency: Choose the frequency as Day from the drop-down.
  • Time zone: Select the Timezone the flow should run.
  • At these Hours: Choose the Hours when the flow should run.
Power Automate create plus 15 days

2. Now, take the Get items flow action to retrieve all the SharePoint list items. Select the Site Address and List Name.

In the Filter Query parameter, provide the expression that will retrieve the list items where a created date is less than or equal to 15 days.

Created le '@{addDays(utcNow(),-15,'MM/dd/yyyy')}'
Power Automate 15 days from today

3. After that, add a Delete item flow action with details like the Site Address and List Name.

  • Id: Select ID of Get items from dynamic content.
adddays function in Power Automate

Then, For each loop will be added by taking the body/ value of the Get items.

4. Now, save and run the flow manually. You can see that the SharePoint list items have been deleted based on the provided expression.

Power Automate adddays function

This is how to use the adddays() expression in Power Automate to add particular days to the default SharePoint columns.

Power Automate Add days to SharePoint Date

When using a SharePoint list, the date and time values need to be manipulated. Now, let us add a year to the date in a Power Automate flow.

Example:

To explain this example, I will use one of my SharePoint lists, ‘Project Details,’ with a few columns like:

Power Automate date add days

Here, I wanted to show how to add a year to the date using the adddays() function in Power Automate.

  • Project start date + Project Duration in days => Update Project End date

So, to add a year to the date using the adddays() function, I will take the Project duration days as 365 days.

Follow the below steps:

1. Create a Power Automate automated cloud flow -> Select When an item is created or modified trigger -> Choose Site Address and List Name.

Power Automate add days to SharePoint date

2. Take Compose flow action and give the below expression. Insert the below-given expression:

addDays(triggerBody()?['StartDate'],int(triggerBody()?['ProjectDurationDays']),'MM/dd/yyyy')
add days to SharePoint date Power Automate

3. Now, choose and select the Update item action. Provide the Site Address, List Name, and Id values from dynamic content.

  • Project End Date: Select outputs of compose action from dynamic content.
Power Automate add years to date

4. Then, save and run the flow. Now, add or modify an item in the SharePoint list.

adddays SharePoint date Power Automate format

5. When the flow triggers and runs successfully, you can see that the Project End Date has been updated in the SharePoint list.

Power Automate add date

This way, you can add a year to the SharePoint date column with the Power Automate adddays() function.

See also  When an item is created in SharePoint list send approval and create item using Power Automate

Power Automate Add Working Days to Date

To know about how to add working days to the date, check out this example:

Example:

I have a Microsoft Form named ‘Product Order Details‘ with a few details as shown in below image:

Power Automate add working days to date

My requirement is to send an email to the responder about the Product Delivery Date that needs to be delivered only on business days [Working days].

Steps to follow:

1. In the Power Automate, select Automated cloud flow -> Choose When a new response is submitted trigger -> Pick Form Id from the drop-down.

add working days to date Power Automate

2. To retrieve the submitted details from the Microsoft form, Select Get response details. Provide Form Id and Response Id from dynamic content.

add working days to date in Power Automate

3. After that, add a Compose flow action to take the Product Ordered date value from dynamic content in the Inputs section.

add date Power Automate

4. Add one more Compose action and select Delivery Estimation days value from the dynamic content.

Power Automate adddays expression

5. Next, add a Select flow action to range the number of days of the year [0-365] and the day of the week for the particular date.

Map the following expressions with values:

KeyValue
DateformatDateTime(addDays(outputs(‘Date’),item()),’yyyy-MM-dd’)
DaydayOfWeek(addDays(outputs(‘Date’),item()))
Power Automate add working days date

The select output will display a range of 365 dates, something like this:

Add business days to date in Power Automate

6. After that, add the Filter array action to filter only the weekdays from the above step.

  • From: Take Outputs of select action from dynamic content.
  • Filter Query: Paste the below-given query in advanced mode.
and(not(equals(item()['day'], 0)), not(equals(item()['day'], 6)))
Power Automate date add working days

7. Next to this, choose and select Compose action to provide the expression that will only get the resulting date by adding days to the Product ordered date.

Expression: body('Filter_array')[outputs('Days')]['date']
Power Automate adddays

8. To send the details regarding the Product delivery date, add Send an email(V2) flow action and Set the parameters like

  • To: Take the responder’s email from the dynamic content.
  • Subject: Add a subject line for the email
  • Body: Provide a description of the email along with outputs of compose that has a resulting date.
Power Automate add bussiness days to date

Save the flow.

9. Whenever a user submits the form, an email about the product delivery date will be sent to the responder’s Outlook, as you can see from the screenshot below.

Power Automate add working days to date format

This is how to add working days to the date using Power Automate.

Conclusion

I hope you got an idea of adddays() in Power Automate. I have explained how to add days to a date in Power Automate with various real examples.

You may also like the following tutorials:

  • 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?

  • Hi There.

    I’m trying to follow your steps for [Power Automate add days to date]

    But I keep getting a failure with this error. [
    InvalidTemplate. Unable to process template language expressions in action ‘Compose’ inputs at line ‘0’ and column ‘0’: ‘The template language function ‘addDays’ expects its first parameter to be a string that contains the time. The provided value is of type ‘Null’. Please see https://aka.ms/logicexpressions#adddays for usage details.’.]

    What am I doing wrong?

  • >