cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
abd3127
Level 8

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
Level: Powered On

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

Super User
Super User

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





Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!





View solution in original post

8 REPLIES 8
Dual Super User
Dual Super User

Re: Formatting Date And time in MS Flow

Hi!

Microsoft Flow team recently releasen 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/es-es/blog/nested-apply-to-each/

Hope this helps





If anyone is trying to help you with an issue, the fastest way to say thanks is by kudoing. Be grateful, Thumbs up!

Proud to be a Flownaut!





Glenda
Level: Powered On

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

kkarmi
Level: Powered On

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

abd3127
Level 8

Re: Formatting Date And time in MS Flow

Hello @kkarmi

 

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

 

Here "tt" gives AM / PM .

 

 

kkarmi
Level: Powered On

Re: Formatting Date And time in MS Flow

thank you very much, it worked like a charm

ShawnKeeneTF
Level: Powered On

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

Super User
Super User

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





Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!





View solution in original post

ShawnKeeneTF
Level: Powered On

Re: Formatting Date And time in MS Flow

Thanks!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,915)