Power Automate: date and time
To know how to get and to format the date and time, it is very useful, particularly, if I want to create for instance, a folder or a file in which the name should include the year or the current month.
After selecting the kind of trigger I want, I will click on the “+” to add a new step:

In the “search” field, put “compose” to select this option:

Click on the “inputs” field then on the “fx” button:

Put this code (it will give the current date and time in UTC) then click on “add”:
formatDateTime(utcNow(),'dd/MM/yyyy HH:mm:ss tt')


IMPORTANT: it is important to respect capital or lowercase characters if not I will not get the correct result:
- For day: it can be “dd” or “d”
- For month: it can be “MM” (number), “MMM” (short name) or “MMMM” (full name)
- For year: it can be “yy” (short number) or “yyyyy” (full number)
- For hour: it can be “H” or “HH”
- For minute: it should be “mm”
- For seconds: it should be “ss”
- Optional: to add AM/PM, keep “tt” or remove it
NOTE:
- By default, it shows in UTC so to convert it to another time zone, I have to add a step
- If I prefer another order or format, just change it, for instance instead of “dd/MM/yyyy HH:mm:ss tt”, I can put “MMM dd yy H:mm”
To convert to another time zone, click on the “+” then put “convert time zone” to select this option:


To fill the fields:
- For “base time”, click on the “lightning” icon to select this option:
- For “source time zone”, let it “UTC”
- For “destination time zone”, select your time zone
- For “time unit”, select one of the options or to enter a specific format, select “enter custom value”, for instance, “MMM dd yyyy HH:mm:ss CET”

To test it, just add another step, for instance “send an email”, read Power Automate: add a picture in an email
Now, if I want to use it for the creation of a folder or a file, I will need to convert it into a string, in such situation, I will add a step, before or after the email test step:
![]() |
![]() |
NOTE: if I put if after the email test step, I can’t use it for my email
After clicking on the “+”, put “initialize” to select:

For the fields:
- Name: put whatever I want, for my article, “name4folder
- Type: select “string”
- Value: click on the “lightining” icon to select either “outputs” or “converted time”, for my article, I will select the second one

To know how to create a folder, read Power Automate: create a folder in sharepoint and/or for a file, read Power Automate: create an excel file in sharepoint.
Interesting Topics
-
Be successfully certified ITIL 4 Managing Professional
Study, study and study, I couldn’t be successfully certified without studying it, if you are interested...
-
Be successfully certified ITIL 4 Strategic Leader
With my ITIL 4 Managing Professional certification (ITIL MP) in the pocket, it was time to go for the...
-
Hide visual and change background color based on selection
Some small tricks to customize the background colour of a text box...
-
Stacked and clustered column chart or double stacked column chart
In excel, I use a lot the combination of clustered and stacked chart...
-
Refresh Power BI
From the Power BI Service, I can set refresh but, for instance, there is no option to do it monthly or each time a change is made...
-
Power BI alerts to be sent by email from an excel file based on condition
I will explain how to send a list of emails from an excel file after creating alerts...