Hi,
I am trying to create a flow that generates Word docs from an Excel table. The flow works fine but I have a problem with the date/time format.
In the 'List rows present in a table step' I have selected ISO 8601 for the DateTime Format.
Then for the next step, which is Populate a Microsoft Word template, I have selected the appropriate excel columns for the Word fields.
However, the output from the generated Word document looks like this:
In the original Excel Entry, the top row is just date value, i.e. 3/1/2023.
The second row original value is 10:00 and last row is 15:00 (I need the 24 hour time format).
How can I format the date to look like this in the Word document?:
3/1/2023
10:00 GMT
15:00 Local
Appreciate any help on this as I am quite new to Power Automate!
I managed to solved the problem.
Instead of using 'Compose' function, I decided to use the formatDateTime expression in the 'Populate a Microsoft Word template' field where I need the dates and time converted.
I got the expression from the 'Format data by examples' feature.
Local time derived from 'LT' column in my Excel sheet:
formatDateTime(parseDateTime(items('Apply_to_each')?['LT']), 'HH:mm', 'en-US')
GMT time derived from 'GMT' column in my Excel sheet:
formatDateTime(parseDateTime(items('Apply_to_each')?['GMT']), 'HH:mm', 'en-US')
As for the date, I used the value from 'Kickoff GMT' column that originally looks like ' 1/3/2023 10:00'. So this expression essentially removes '10:00' and converts 1/3/2023 to 'Wednesday, March 1 2023'
concat(formatDateTime(parseDateTime(items('Apply_to_each')?['KickOff GMT']), 'dddd', 'en-US'), ', ', formatDateTime(parseDateTime(items('Apply_to_each')?['KickOff GMT']), 'MMMM d yyyy', 'en-US'))
The final output on my Word document looks like this:
Hope this is helpful to anyone else facing similar issue as I did.
I appreciate your help @v-bofeng-msft !
Thanks for your suggestion,
I have tried your solution but it seems there is an error:
Is it correct to put the 'Compose' function between the 'Populate a Word Document' and 'Create File'?
Thanks again!
Hi @Anonymous ,
Please try:
concat(
formatDateTime(items('Apply_to_each')['DateTimeColumn'],'dd/MM/yyyy'),
decodeUriComponent('%0A'),
formatDateTime(items('Apply_to_each')['DateTimeColumn'],'HH:mm'),
' GMT',
decodeUriComponent('%0A'),
formatDateTime(addHours(items('Apply_to_each')['DateTimeColumn'],5),'HH:mm'),
' Local'
)
Best Regards,
Bof
Michael E. Gernaey
497
Super User 2025 Season 2
David_MA
436
Super User 2025 Season 2
Riyaz_riz11
244
Super User 2025 Season 2