2 Ways to Get Today’s Date in Power Automate

Do you need to get the current date in your flows? This post is going to show you how to get today’s date in Power Automate.

You might need the current date in Power Automate to create dynamic workflows or automation on time-based conditions.

Power Automate has built-in expressions and actions for getting the current date and time in UTC, but you’ll then need to convert this to your timezone!

Get Today’s Date with the UTCNOW Function

Power Automate has a built-in workflow expression function to help you get the current date.

utcNow()

The utcNow function will return the current date and time in Universal Time Coordinated (UTC).

UTC is a 24-hour time standard most commonly used as a basis for comparing timezones. A time zone will be defined as its offset from UTC.

For example, eastern standard time can be described as UTC-05:00 since it is 5 hours behind UTC.

The utcNow function will return a timestamp string in the format yyyy-MM-ddTHH:mm:ss.kkkkkkkZ, where y is years, M is months, d is days, H is hours, m is minutes, s is seconds, and k is fraction of seconds.

Since this is in UTC, you will need to convert it into your own timezone.

Thankfully, Power Automate also has an expression that will convert UTC timestamps to any other time zone.

The convertFromUtc function will convert UTC to a given timezone.

convertFromUtc(utcNow(),'Eastern Standard Time','yyyy-MM-dd')

The above expression will convert the timestamp resulting from utcNow() to the 'Eastern Standard Time'.

You can check out this post from Microsoft for a complete list of timezone strings you can use in the convertFromUtc function.

This expression also has a third argument that allows you to specify the date and time format that’s returned. The above will return only the date part of the date timestamp using 'yyyy-MM-dd' format string.

This will result in a simple date-only value of today’s date in your chosen timezone.

Get Today’s Date with the Current Time Action

If the expressions aren’t appealing to you, the good news is there is a more user-friendly option available.

These expressions are available as actions you can add to your flow.

You can follow these steps to get today’s date in your flow using the step actions.

  1. Add the Current time action to your flow. This is equivalent to the utcNow function seen previously.
  2. Add the Convert time zone action to your flow.
  3. Add the Current time as dynamic content to the Base time input in the Convert time zone action.
  4. Select Enter custom value in the Format string dropdown. This will allow you to enter your own custom format string, but you can also select any of the preset format options.
  5. Enter yyyy-MM-dd into the Format string input.
  6. Select (UTC) Coordinated Universal Time from the Source time zone options.
  7. Select your timezone from the Destination time zone options.

When you run the flow you will get the current date timestamp in UTC from the Current time action, then the Convert time zone action will convert this to your chosen timezone and format it as a date-only value.

This gets you today’s date, but it will take you two actions. In comparison, the expression approach can be used inside any other action’s input to help shorten your flows.

Conclusions

Getting today’s date in your flow can be a critical part of your workflow.

Power Automate’s workflow definition language offers functions to return the date and time in UTC. There is also an expression to convert UTC times into any other timezone.

Custom formatting then allows you to get only the date value from the date and timestamp.

These expressions are also available in more user-friendly actions.

Did you know how to get the current date in your flows? Do you know any other way to do this? Let me know in the comments below!

About the Author

John MacDougall

John MacDougall

John is a Microsoft MVP and freelance consultant and trainer specializing in Excel, Power BI, Power Automate, Power Apps and SharePoint. You can find other interesting articles from John on his blog or YouTube channel.

Related Articles

Comments

0 Comments

Get the Latest Tech Tips

Write For Us

Are you a tech enthusiast with a talent for writing great content? Come write for us!

Follow Us

Follow us on social media to stay up to date with the latest in tech!