cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Advocate IV
Advocate IV

Re: Formatting Date And time in MS Flow

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

Highlighted
Memorable Member
Memorable Member

Re: Formatting Date And time in MS Flow

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

9 REPLIES 9
Highlighted
Dual Super User III
Dual Super User III

Re: Formatting Date And time in MS Flow

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!



Highlighted
Advocate IV
Advocate IV

Re: Formatting Date And time in MS Flow

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

Highlighted
Frequent Visitor

Re: Formatting Date And time in MS Flow

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

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Formatting Date And time in MS Flow

Hello @kkarmi

 

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

 

Here "tt" gives AM / PM .

 

 

Highlighted
Frequent Visitor

Re: Formatting Date And time in MS Flow

thank you very much, it worked like a charm

Highlighted
Helper I
Helper I

Re: Formatting Date And time in MS Flow

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

Highlighted
Memorable Member
Memorable Member

Re: Formatting Date And time in MS Flow

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

Highlighted
Helper I
Helper I

Re: Formatting Date And time in MS Flow

Thanks!

Highlighted
Post Prodigy
Post Prodigy

Re: Formatting Date And time in MS Flow

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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Users online (8,465)