#PowerPlatformTip 6: 'formatDateTime in utcNow'
TL;DR: Format dates directly with
utcNow('your-format')instead of wrapping it in a separateformatDateTimecall.
🧰 Free tool: Test your
utcNow()/formatDateTimeformat strings with a live preview (remember:MMis month,mmis minute): utcNow date format tester.
💡 Challenge
Working with dates and times often requires using formatDateTime with utcNow to format values, adding unnecessary complexity and extra steps in your flow.
✅ Solution
Format the date directly within utcNow by passing your desired format string, eliminating the separate formatDateTime function.
🔧 How It’s Done
1. Use utcNow with format parameter
🔸 Instead of using formatDateTime(utcNow(), 'your-format'), call utcNow('your-format').
The action’s Code View: the whole expression is just utcNow('dd.MM.yyyy'), no nested formatDateTime needed.
2. Apply your date-time format
🔸 Use the same format string you need directly inside utcNow.
Real flow run: both approaches produce the same output, 23.09.2026 - the direct call just skips the extra step.
3. Test your flow
🔸 Run and verify your flow in a non-production environment to ensure it works as expected.
🎉 Result
By directly formatting dates within utcNow, you simplify and streamline your flows, reducing nested function calls and improving readability. The comparison only shows that the outputs are the same, it does not measure run time.
🌟 Key Advantages
🔸 Simplicity: Eliminates the need for an additional formatDateTime function.
🔸 Efficiency: Reduces the number of expressions in your flow.
🔸 Clarity: Makes your flow easier to read and maintain.
🛠️ FAQ
1. What format strings can I use with utcNow()?
You can use .NET date and time format strings. ‘yyyy-MM-dd’ and ‘HH:mm:ss’ are custom format patterns, and you can combine them as needed. Single-letter standard formats such as ‘D’ or ‘g’ work too.
2. Is utcNow() always in UTC timezone?
Yes, utcNow() always returns the current time in UTC. If you need local time, consider using the convertTimeZone() function.
3. Can I combine utcNow() formatting with other functions?
Absolutely! You can chain utcNow() with other functions like addDays(), addHours(), or use it within expressions for complex date calculations. Calculate with the full timestamp first and format only the result, for example formatDateTime(addDays(utcNow(), 1), 'dd.MM.yyyy'). If you format first (for example to the time only), the date is already lost for a later day calculation.
🔗 Related Tips
🔸 #PowerPlatformTip 17: ‘Format Data by Example’ - let Power Automate generate other tricky formatting expressions for you the same way.
🔸 #PowerPlatformTip 112: ‘Consistent Data Formats’ - keep formatted dates and other values consistent across your whole flow.
This tip is by Marcel Lehmann, Microsoft MVP (Business Applications) and founder of the Power Platform Academy, which runs free live workshops (in German). See the next free workshop dates (in German). For companies that want this implemented for them, see KMUpower: Power Platform consulting & automation for SMEs (DACH).