Power Automate getFutureTime() Function

Do you know how to get future time in a Power Automate flow? If you are unaware, you are at the right place to know how to get it.

This Power Automate tutorial will guide you on how to work with the Power Automate getFutureTime() function. Additionally, you will see an introduction to the Power Automate getFutureTime() function, its syntax, and a few examples of it.

Power Automate has the getFutureTime() function, which helps add specific time units to the current timestamp units like seconds, minutes, hours, days, weeks, months, or years based on unique needs.

Power Automate getFutureTime() Function

Power Automate “getFutureTime()” is designed to add specific time of units to a current timestamp. This function allows users to add different time units, such as seconds, minutes, hours, days, weeks, months, or years, to get the future time.

The return value from the getFutureTime() function will be a timestamp plus the specified number of time units.

Regarding the addToTime expression, giving positive time intervals will add the specific time unit to the time stamp. On the other hand, negative time intervals will exclude or subtract the duration from the time stamp.

Let’s take the current date and time as “2023-12-18T06:35:02“. I wanted to get the future time in 10 seconds. Then, my result will be 18/12/2023T06:35:12.

Power Automate getFutureTime() function

This is a brief introduction to the Power Automate getFutureTime() function.

Power Automate getFutureTime() Syntax

The syntax for a Power Automate getFutureTime() function looks like this:

getFutureTime('interval', 'timeunit', 'format')

Parameters:

  • Interval: It is in the form of an integer where a particular number of time units are added.
  • Time Unit: It represents the unit of time that can be used with intervals like Second, Minute, Hour, Day, Week, Month, and Year.
  • Format: It is an optional field where a user can provide a custom timestamp format. It will take the default format[yyyy-MM-ddTHH:mm: ss.fffffffK] if not provided.

Example:

For example, I will add 1 day as a time unit to the current date. Let’s say the current date is”16-12-2023“.

getFutureTime(1, 'Day')
  1. 1 = Specify a particular interval of time unit.
  2. Day = Provide the time unit like Second, Minute, Hour, Day, Week, Month, and Year per your need.

Here will be the output as 2023-12-17T00:00:00.0000000Z.

This is the overview of Power Automate’s getFutureTime() function syntax.

Power Automate getFutureTime() in Seconds

I will illustrate an example of Power Automate getFutureTime() in seconds in a flow.

Example:

I will add a specific number of seconds to the current timestamp. So, the outcome will display a current date and time with the additional seconds.

Let’s take the current date and time as “2023-12-18T06:35:02“. To this date, I am required to get 10 seconds. Then, my result will be 18/12/2023T06:35:12, as shown below.

Power Automate getFutureTime() expression

So, Let’s dive into the below steps!

1. Open the Power Automate Home page -> Tap on +Create -> Select Instant cloud flow -> Take Manually trigger a flow and enter a flow name -> Click Create.

  • Open the trigger -> Click Add an input -> Select Date.
Power Automate addToTime() function

2. Add an Initialize variable flow action below the flow trigger to give the getFutureTime() expression into a flow. This action will store the date information, which can be utilized throughout the flow when necessary.

Set the parameters of the initialized variable.

  • Name: Enter the variable name manually as Date.
  • Type: Select String datatype.
  • Value: Click the field -> Click Expression -> Take the code below.
getFutureTime(10,'Second','dd/MM/yyyyTHH:mm:ss')

Click OK.

Power Automate getFutureTime() in Seconds

3. To view the output of the Power Automate getFutureTime() function, we can use the Compose flow action.

Inputs: Click the field -> Take the Date variable from dynamic content.

Microsoft Power Automate getFutureTime() in Seconds

4. After creating the flow, Save and Test the flow manually. In the Run flow window, pick the triggered date the unit needs to be added.

Power Automate flow getFutureTime() in Seconds

5. Upon successful execution, the flow will notify like “Your flow ran successfully.” Next, open the compose flow action to view the output. The displayed output will reflect the returns of the getFutureTime() expression, as demonstrated below.

  • The current date and time will be [18/12/2023T06:35:12].
getFutureTime() expression in Power Automate

This is how to add seconds to the date using the Power Automate getFutureTime() function.

Power Automate getFutureTime() in Minutes

Now, we will see about Power Automate addToTime() in the minutes time unit.

Example:

Similarly, I must add a designated number of minutes to the current date and time. Thus, the updated Today’s date and time will reflect its added minutes.

Assuming today’s date is “2023-12-18,” adding 20 minutes to the current time will result in 18-12-2023T07:30, as seen in the screenshot below. Presently, the current time is [2023-12-18T07:10:10].

Power Automate flow getFutureTime() in Minutes

Look at the steps that are mentioned below:

1. In the ‘Initialize variable‘ flow action, change the getFutureTime() expression to add minutes to the timestamp. Give the variable properties.

  • Name: Enter the variable name manually as Date and Time.
  • Type: Select datatype String from drop-down. 
  • Value: Give the value that is given in the code below.
Value: getFutureTime(20,'Minute','dd-MM-yyyyTHH:mm')

After giving the expression, Select OK.

Power Automate getFutureTime() in Minutes

2. This output will be retrieved from the compose flow action by adding minutes to the current date and time as below.

Timestamp: Current date with time 2023-12-18T07:10:10, and the result date will be 18-12-2023T07:30.

Get FutureTime() in Minutes Power Automate

This is about how to getFutureTime in minutes from the current timestamp using the Power Automate getFutureTime() function.

Power Automate getFutureTime() in Hours

In this section, let’s see how to get the future time in hours from the current timestamp using a Power Automate getFutureTime()function.

Example:

I will add a specific number of hours to a given timestamp. For instance, suppose we have a timestamp of “ 2023-12-18T07:41 ” and need to add 7 hours. In that case, the resulting timestamp will be “18/12/2023T14:44,” as shown below.

get Future time in Hours using Power Automate

Follow the steps below:

1. In the Compose flow action, give the getFutureTime() expression to add hours to the current timestamp.

Inputs: Select field -> Click Expression -> Add the code below.

getFutureTime(7,'Hour','dd/MM/yyyyTHH:mm')

After that, Click OK.

get Future time in Hours using Microsoft Power Automate functions

2. Once you have saved the flow, select the desired date for the unit to be added in the “Run flow” window. Then, Click Run flow.

  • Here, the triggered date will be 18-12-2023.
Power Automate flow getFutureTime() in Hours

3. Check out the timestamp retrieved from the getFutureTime() expression in the compose outputs. The result will add the given hours to the current timestamp [18/12/2023T14:44].

get Future time in Hours using Power Automate flow

This is how to use the Power Automate getFutureTime() function to add hours to the present timestamp and obtain future time.

Power Automate getFutureTime() in Days

Let’s delve further into the Power Automate getFutureTime() function and explore how to get additional days into the timestamp to get future time in days.

Example:

In this example, we wanted to get future time in days. Thus, we can add specific days to a current timestamp.

Suppose we start with a timestamp of “2023-12-18” and intend to add 2 days. In that case, the resulting timestamp would be “2023-12-20,” as illustrated below.

Power Automate flow to get the future time in days

Follow the same steps that are mentioned in the above example:

1. In the Inputs of the compose flow action, give the expression to get the future time in days to the current timestamp.

Inputs: Select the field -> Click Expression -> Add the expression given below.

getFutureTime(2,'Day','dd-MM-yyyy')

After that, Click OK.

How to get the future time in days using Power Automate getFutureTime() function

2. Once the flow has been saved, select the desired date for the unit to be added in the “Run flow” window. Then, click Run flow.

getFutureTime() in days Power Automate flow

3. The image below illustrates the getFutureTime() function results, which adds two days to the current timestamp.

  • The result will be 20-12-2023.
Power Automate flow getFuture Time() expression in days

This is about the Power Automate getFutureTime() function to add days to a current timestamp.

Power Automate getFutureTime() in Months

In this section, let’s look at the example that will add a month to the current date to get the future time in days.

Example:

Suppose we have a current timestamp of “2023-12-18“. We must add 6 months to the current date to retrieve the future month. Thus, the “getFutureTime()” expression will return an output of “18-06-2024,” as it adds the specified number of months to the current date.

Power Automate getFutureTime() in Months

To work around this, follow the steps below:

1. In the getFutureTime() expression of the compose flow action, modify the time unit to Month to enable adding the specified number of months to the current date.

Inputs: Select the field -> Click Expression -> Give the expression given below.

getFutureTime(6,'Month','dd-MM-yyyy')

Then, Select OK.

Use Power Automate getFutureTime() function

2. Look out for the timestamp retrieved from the getFutureTime() expression in the compose outputs, displaying the given date + specified number of time units.

  • The triggered date is 2023-12-18, and the return output will be 18-06-2024.
Power Automate flow getFutureTime() in Months

This is all about how to add a month to the date to get the future time using the Power Automate getFutureTime() function.

Power Automate getFutureTime() in Year

Let us take an example of adding a year to the current date by utilizing a Power Automate getFutureTime() expression.

Example:

Let us consider the current date as “2023-12-18“. We need to add 4 years to this timestamp. Therefore, the output will be “2027-12-18” after applying the getFutureTime() function, adding the specified years to the input timestamp.

To do this example, follow the below given steps.

Power Automate  flow to getFutureTime() in Year

1. Similarly, change the format of getFutureTime() expression to include a year in it. Refer to the below-given code to provide expression in the Inputs of compose.

Inputs: Click the field -> Select Expression ->Take the code given below.

getFutureTime(4,'Year','yyyy-MM-dd')

Click Ok.

Power Automate getFutureTime() in Year

3. The Power Automate getFutureTime() function will give the output relevant to the expression by adding a year to the given timestamp.

  • The return value from the getFutureTime() expression is 2027-12-18 [Triggerd Date 2023-12-18].
getFutureTime() in Year using Power Automate  flow

This is all about getFutureTime() expressions and how to utilize this function in a Power Automate flow to get the future time in various formats.

Conclusion

This tutorial will enhance your comprehension of the Power Automate getFutureTime() expression utilizing diverse examples. Additionally, this tutorial covers the following topics related to the getFutureTime() function:

  • Power Automate getFutureTime in second
  • Power Automate getFutureTime in minutes
  • Power Automate getFutureTime in an hour
  • Power Automate getFutureTime in the day
  • Power Automate getFutureTime in a month
  • Power Automate getFututeTime in the year

Furthermore, you may like some more Power Automate tutorials: