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’)
After run the below flow on update of Account it will take the proper output as show in below screenshot:
Please find below more examples for different date time formats using formatDateTime() function:
- formatDateTime(utcNow(),’MM/dd/yyyy h:mm tt’)
- formatDateTime(utcNow(),’dd-MMMM-yyyy h:mm tt’)
- formatDateTime(utcNow(),’dd-MMM-yyyy h:mm tt’)
- formatDateTime(utcNow(),’yyyy-MM-ddThh:mm:ss’)
Conclusion
With help of formatDateTime function we can easily convert DateTime and Date field value into various ISO DateTime formats.
One Pic = 1000 words! Analyze data 90% faster with visualization apps!
Get optimum visualization of Dynamics 365 CRM data with –
Kanban Board – Visualize Dynamics 365 CRM data in Kanban view by categorizing entity records in lanes and rows as per their status, priority, etc.
Map My Relationships – Map My Relationships – Visualize connections and relationships between Dynamics 365 CRM entities or related records in a Mind Map view.