Converting DateTime field in a different format in Power Automate using formatDateTime function.

Sending
User Review
0 (0 votes)

Introduction

In this blog, we can see how we can convert DateTime type field to the various format using formatDateTime function. Please find the syntax of formatDateTime function:

formatDateTime(DATE_TIME_VALUE,DATE_TIME_STRING_FORMAT)

Scenario:

One of our clients wanted to see the last modified date and time of individual Account record. Also, he wants to see this modified date and time in specific format such as “Monday 23-Nov-2020 6:24 AM”.

Solution:

We have created one Microsoft Flow which will trigger on Account record update and on update of account record we are get the current Date Time value using utcNow() function and convert it in to specific format that client wants and finally update formatted date in to current record as shown in below screenshot:

formatDateTime(utcNow(),’yyyy-MM-ddThh:mm:ss’)

Converting DateTime field in a different format in Power Automated using formatDateTime function

After run the below flow on update of Account it will take the proper output as show in below screenshot:

Converting DateTime field in a different format in Power Automated using formatDateTime function

Please find below more examples for different date time formats using formatDateTime() function:

  1. formatDateTime(utcNow(),’MM/dd/yyyy h:mm tt’)

Converting DateTime field in a different format in Power Automated using formatDateTime function

  1. formatDateTime(utcNow(),’dd-MMMM-yyyy h:mm tt’)

Converting DateTime field in a different format in Power Automated using formatDateTime function

  1. formatDateTime(utcNow(),’dd-MMM-yyyy h:mm tt’)

Converting DateTime field in a different format in Power Automated using formatDateTime function

  1. formatDateTime(utcNow(),’yyyy-MM-ddThh:mm:ss’)

Converting DateTime field in a different format in Power Automated using formatDateTime function

Conclusion

With help of formatDateTime function we can easily convert DateTime and Date field value into various ISO DateTime formats.