Power Automate AddDays Function Explained

Power Automate AddDays Function

Learn how to add days in power automate! In this document we explain the Power Automate addDays function.

See how to use addDays In Power Automate in a step-by-step guide. Last but not least, we address so common questions on the Power automate addDays function.

Power Automate AddDays Function

The Power Autmate addDays function adds a given number of days to a timestamp and optionally formats the result by a given format.

Syntax

addDays('<timestamp>', <days>, '<format>'?)

Input parameters

  • timestamp (mandatory): The timestamp which used as basis for the addition of days.
  • days (mandatory): The number of days to be added.
  • format (optional): A format string to defines the format of the result. For details check out: How to format date and time in Power Automate

Return Value

  • The result of adding days to the given timestamp. In case there is format provided, it will format the result accordingly.

Power Automate addDays expression example

How To Use addDays In Power Automate

In this guide, we add one day to utcNow function result. We set the date on tomorrow at the same time.

  1. Create a new Power Automate flow with ‘Manually trigger a flow’ trigger.

    Power Automate AddDays new flow

    New Microsoft flow

  2. Add new step by clicking on ‘+ New Step’

    Power Automate AddDays new step

    Add a new step

  3. Search for ‘initalize’ and select ‘Initialize variable’

    Power Automate AddDays initialize variable

    Add Initialize variable step

  4. Set Initialize variable Name ‘now’, Type ‘String and Value ‘utcNow()’ via Expression editor

    Power Automate AddDays utcnow

    Set variable to utcNow

  5. Add a compose step by searching for ‘compose’ and clicking on ‘Compose’

    Power Automate AddDays compose

    New Compose step

  6. Set input of Compose action to ‘addDays(variables(‘now’),1)’ via expression editor

    Power Automate AddDays

    Power Automate addDays expression

Here is the Power Automate addDays expression for copy & paste.

addDays(variables('now'),1)

Examples – Power Automate addDays Function Expression

Does Power Automate addDays work with negative numbers?

Yes, it does. Despite the function name, the following example is actually subtracting 10 days.

addDays(variables('now'),-10)

Leave a Comment

Your email address will not be published. Required fields are marked *