web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / Power Melange / Date Time Format in Power A...

Date Time Format in Power Automate – Simplified for you

PowerMelangeByShalinee Profile Picture PowerMelangeByShalinee 70

Business Scenario: There are a lot of scenarios where we need specific formats for DateTime – say the case when you have to send a JSON where the receiver just accepts DateTime in a particular format or you want to display it to the user in a particular style or maybe you just want to extract some particular part from the Datetime or what day it is, which month, etc etc.

For all of the above scenarios, there is just one solution – formatDateTime()

The datetime by default comes like this: 2022-01-04T12:55:02.9280661Z which is NOT AT ALL convenient to read. Hence lets format it!

Here is an example from a simple flow:

When we run it:

Use this image to get the desired results: [Download this image to keep it handy]

Put the required date in DateTimeStamp and the required format within single quotes after the comma.

To know more about abbreviations, go to this link:
https://docs.microsoft.com/en-us/system-center/orchestrator/standard-activities/format-date-time?view=sc-orch-2019

You may also use some other separator other than ‘hyphen’ like ‘front-slash’ [/], etc.

Example: formatDateTime(utcNow(),’dd/MM/yyyy’)

Also you may explore other options of predefined patterns:

Example: formatDateTime(utcNow(),’D’)

To explore more pre-defined patterns, use this link:
https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings

Hope it helps!

& the Power Quote of the day is:
“If you fell down yesterday, stand up today” – H.G. Wells

Happy New Year!
May the year be opalescent in particular. May Life be iridescent in general’


This was originally posted here.

Comments

*This post is locked for comments