Power Automate addDays() Function + Examples

Have you ever used the addDays() function in Power Automate? This tutorial will explain the Power Automate addDays() function and its syntax.

Also, I will discuss how to use Power Automate addDays() and some more examples like below:

  • Power Automate addDays() to utcNow
  • Power Automate addDays() to Date Variable
  • Power Automate addDays() negative
  • Power Automate addDays() to SharePoint date

Power Automate addDays() Function

Power Automate addDays() function helps add a given number of days to the time stamp and formats the date result in a provided format. When using this function, a user must provide some days to add to the time stamp.

Power Automate addDays() Syntax

The Power Automate addDays() function syntax is like the one below:

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

Parameters:

  • Timestamp: It is a mandatory field with date and time in a string format.
  • Days: It is also a required field where we need to include a positive or negative number of days to add.
  • Format: It is optional to format the string in a specific format. The default format is [yyyy-MM-ddTHH:mm:ss.fffffffK].

The output returned from this function() will be in the form of a string with The timestamp plus the specified number of days.

Example: addDays(‘2023-11-20T00:00:00Z’, 10, ‘yyyy-MM-dd’) => It will give the output as 2023-11-30.

Power Automate addDays() Examples

I will show you examples based on the addDays() function in Power Automate flow.

So let’s build a Power Automate flow to explain all these examples:

Follow the below given steps:

Power Automate addDays() to utcNow

1. Create an ‘Instant cloud flow’ in Power Automate. Instructions to follow: 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 text input.

Power Automate addDays() function

2. After that, add an ‘Initialize variable’ flow action to store the text values during the flow and set details of the variable like NameType, and Value.

Value: addDays(utcNow(),3,'dd-MM-yyyy')
Power Automate addDays() function to utcNow

3. Now, add the ‘Compose’ data operation to check the output from the addDays() expression.

Power Automate addDays() Function

4. Once the flow is done, click on Save and Test. Test the flow Manually. In the Runflow window, provide the Date value -> Click on Runflow.

5. When the flow runs successfully, open the ‘Compose’ flow action to check the output from the addDays() expression.

Power Automate addDays() to utcNow

Power Automate addDays() to Date Variable

1. In the ‘Initialize variable’ flow action, store the text values during the flow and set details of the variable like NameType, and Value.

Value: addDays(triggerBody()['key-button-date'],5,'MMMM dd ,yyyy')
Power Automate addDays() to date

In the Run flow window, select and trigger a date to which you want to add days to it.

2. In the ‘Compose’ flow action, check the addDays() expression output from addDays() to date.

Power Automate addDays() to date variable

Power Automate addDays() negative

For this, follow the same pattern of steps to illustrate the example on addDays() with negative values in Power Automate.

1. In the same way, only change the expression of addDays() in the initialize variable and set details like Name, Type, and Value.

Value: In the value add the below expression.

Value: addDays(triggerBody()['date'],-10,'MMM dd, yyyy')
Power Automate addDays() negative

If a user uses the negative values in the addDays() expression, it will give the output as a specific date value, subtracting that number of days from it.

2. To check out the output from the addDays() function, open the compose data operation as shown below.

Power Automate addDays() format

Power Automate addDays() to SharePoint date

In this, let’s create a Power Automate ‘Automated cloud flow’ that will trigger automatically with a ‘When an item is created’ trigger.

1. Browse make.powerautomate.com in the browser to open the Power Automate Home page. On the Home page, click +Create -> Select ‘Automated cloud flow’ -> Give flow name and choose the trigger -> Click Create button.

  • In the trigger, add the Site Address and List Name.
Power Automate addDays() to Sharepoint date

2. Under the trigger, take an ‘Initialize variable’ to initialize a date column of SharePoint. Set Name, Type, and Value.

Power Automate addDays() syntax

3. In the ‘Compose’ data operation, add the expression of addDays() as given below.

addDays(variables('Task Deadline'),7,'dd/MM/yyyy')
Power Automate addDays() to date column

4. After Saving and Testing the flow Manually. Add a new item to the SharePoint list.

5. Then, the outputs of the compose flow action will show the date, adding specific days to the date as below.

Power Automate expression addDays() to date

This is how to use the Power Automate addDays() function to calculate and add days to date and time inside a flow.

Conclusion

In this tutorial, I have explained how to use the addDays() function in Power Automate and also various examples related to the Power Automate addDays() function.

  • Power Automate addDays() to utcNow
  • Power Automate addDays() to Date Variable
  • Power Automate addDays() negative
  • Power Automate addDays() to SharePoint date

You may also like:

>

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…