cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
abd3127
Kudo Kingpin
Kudo Kingpin

Formatting Date And time in MS Flow

Hello ,

I am using flow to read my events and send me mail for upcoming events in my calendar.

Here i am getting the date correctly.

But when it comes to Time ,It does not show me the local time.

I want to display the time in my local time .

How can i format the datetime so that i can get time ????

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Glenda
Advocate IV
Advocate IV

Hi @abd3127,

 

You can indeed use the convertTimeZone function. The function works as follows: convertTimeZone(timestamp:string, sourceTimeZone:string,destinationTimeZone:string, format?:string).

 

I've just tested the below function:

convertTimeZone(utcnow(),'UTC','W. Europe Standard Time','dd/MM/yyyy HH:mm')

utcnow() was in this case "2017-11-24T13:15:44.4817469Z". The formatted date in my e-mail is as follows: "24/11/2017 14:15".

 

Here you can find a list of time zones: https://msdn.microsoft.com/en-us/library/gg154758.aspx.
If you want to format your string different you can use the following as a reference: https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings.

 

Good luck!

 

View solution in original post

Hey @ShawnKeeneTF

 

 

You need to go to the expressions tab and then under the date and time functions you get the function convertTimeZone

Expressionstab.PNGWhen you found the function you can fill it in with dynamic content or just type whatever you want in it.

convertTimeZone.PNG

When you are finished with filling in your expression you should have something like this

convertTimeZonefinish.PNG

 

Hope this helps

 

Kind regards

 


Tom



If this reply has answered your question or solved your issue, please mark this question as answered.

Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

View solution in original post

10 REPLIES 10
efialttes
Super User
Super User

Hi!

Microsoft Flow team recently released a bunch of Date related action blocks, one of them is called "Convert time zone". I haven't tested it myself yet, but it sounds promising.

You will find more info here:

https://flow.microsoft.com/en-us/blog/working-with-dates-and-times/

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Glenda
Advocate IV
Advocate IV

Hi @abd3127,

 

You can indeed use the convertTimeZone function. The function works as follows: convertTimeZone(timestamp:string, sourceTimeZone:string,destinationTimeZone:string, format?:string).

 

I've just tested the below function:

convertTimeZone(utcnow(),'UTC','W. Europe Standard Time','dd/MM/yyyy HH:mm')

utcnow() was in this case "2017-11-24T13:15:44.4817469Z". The formatted date in my e-mail is as follows: "24/11/2017 14:15".

 

Here you can find a list of time zones: https://msdn.microsoft.com/en-us/library/gg154758.aspx.
If you want to format your string different you can use the following as a reference: https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings.

 

Good luck!

 

View solution in original post

kkarmi
Frequent Visitor

Thank you for advise, it worked like a charm 🙂 Can you please let me know how I can add AM/PM to the formated value. None of the combinations worked for me - 'yyyy-MM-dd hh:mm:ss a', 'yyyy-MM-dd hh:mm:ss AM/PM'. All throwing "he datetime string must match ISO 8601 format" error

Thank you,

Kirill

Hello @kkarmi

 

Try 'yyyy-MM-dd HH:mm tt'

 

Here "tt" gives AM / PM .

 

 

kkarmi
Frequent Visitor

thank you very much, it worked like a charm

Where do I enter this code? Can I use it directly inline in the Flow Editor's "Start an Approval" action?

 

My problem is that I start a flow when a user adds an item to a SharePoint list. The SharePoint site regional settings/time zone is set to Central Time, but the email notice about the approval (from the Flow) uses a different time format.  Here's an example:

 

1.pngI tried adding the Convert Timezone action block just before the "Start Approval" block, but how do I reference the converted time zone in the Approval block?  Or does anything need to change and i just keep the approval block as-is?

2.png
Or, should I remove the Convert Timezone block, and just wrap the begindate/enddate parts of the Approval Details in the function like this?

 

3.jpg

Hey @ShawnKeeneTF

 

 

You need to go to the expressions tab and then under the date and time functions you get the function convertTimeZone

Expressionstab.PNGWhen you found the function you can fill it in with dynamic content or just type whatever you want in it.

convertTimeZone.PNG

When you are finished with filling in your expression you should have something like this

convertTimeZonefinish.PNG

 

Hope this helps

 

Kind regards

 


Tom



If this reply has answered your question or solved your issue, please mark this question as answered.

Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

View solution in original post

Thanks!

Thanks @Glenda , this is what I was looking for, works great. 

edd_
New Member

Hello,

 

I am using the automated flow "track your working hours in Excel Online (Business) spreadsheet."

 

I am happy to be able to set it up but the output I have for time is in UTC, how do i change it to a different time zone?

 

The expression in use currently is

 

formatDateTime(triggerOutputs()['headers']['x-ms-user-timestamp'],'hh:mm tt')

 

Thanks

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (1,390)