cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Formatting Date And time in MS Flow

I am running into a problem when trying to get the date/time out of a column. I need it to display what is in the column and cant figure out how to format it in Flows. Attached is the issue and my flow. I need it to read the date/time in a mm/dd hh:mm AM/PM. any help will be greatly appreciated!

Flow 2.PNGFlow 1.PNG

2 ACCEPTED SOLUTIONS

Accepted Solutions
ScottShearer
Most Valuable Professional
Most Valuable Professional

@Anonymous- give this a try:

 

I used this format ina an expression:

formatDateTime(utcNow(),'MM/dd hh:mm tt')
 
Which produced a date/time string that looks like this:
07/20 08:08 PM
 
DateFormat.jpg
 
If this works for you, please mark you Post as Solved.
 
Scott

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

HI Kamel,

If you are still having an issue with formatting the date, have you tried to use "Convert Timezone"?  I convert all dates before I send them in an alert.  There are many formating options for you to choose.

 

ConvertTimeAction.jpg

 

Hope this helps,

Joe

View solution in original post

26 REPLIES 26
ScottShearer
Most Valuable Professional
Most Valuable Professional

@Anonymous- give this a try:

 

I used this format ina an expression:

formatDateTime(utcNow(),'MM/dd hh:mm tt')
 
Which produced a date/time string that looks like this:
07/20 08:08 PM
 
DateFormat.jpg
 
If this works for you, please mark you Post as Solved.
 
Scott

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Anonymous
Not applicable

Worked like a charm! Thank you so much!

Anonymous
Not applicable

It worked once and then quit and went back to sending the way it was 😞

HI Kamel,

If you are still having an issue with formatting the date, have you tried to use "Convert Timezone"?  I convert all dates before I send them in an alert.  There are many formating options for you to choose.

 

ConvertTimeAction.jpg

 

Hope this helps,

Joe

Anonymous
Not applicable

Greetings

 

I tried this :

formatDateTime(utcNow(), 'MM/dd hh:mm:tt')

 

To update dates and times for Form submited for approval , however it shows todays's date and I am trying to show the dates from the form submitted , how can I format this dates so it shows the right format when email is received for approval ?

Approval email example vs form submitted

 

 

formatDateTime( [your date here] , 'MM/dd hh:mm:tt')

Anonymous
Not applicable

I'm building a flow that would notify certain users when dates are changed. I did the following:
1. I created 2 hidden fields: Old Start date and Old End date (Date and Time fields in Sharepoint Events List).
2. In my flow, I convert all four fields (Old and New Start dates and End Dates) from UTC to NZST with format mm/d/yyyy h:mm AM/PM.
3. I check:
   A. New and Old Start dates are equal, and
   B. New and Old End Dates are equal
If false, Sharepoint sends an email to users that these dates have been changed.
4. The item is updated to populate the Old Start and End dates with the values from the New Start and End dates.

 

My problem is whether I use the New or the converted values to update the Old value fields, the values returned to Sharepoint turn out differently from the unconverted values.

Is there any way to fix this?

Anonymous
Not applicable

convert time zone .jpg

 

This is how I fixed time zone in my flow .

1. Started my flow  with the action, in this case is when an item is created in sharepoint list ,

2. I added Convert time zone action after one for the start date and another for the End time

Here is how it looks

 

 

Anonymous
Not applicable

Thanks, but strangely, it's working now. 

 

I removed all the conversions and just used the fields themselves. I think there's just a delay in displaying the changes to the Old and New Start dates in Sharepoint. And I think the only mistake I had in the first place was having "Date and Time" format for the New dates, and the "Date only" format for the Old Dates. After aligning those formats, I started adding the conversions and other stuff in it and the delay didn't help either. 

Anonymous
Not applicable

I'm using the Convert Time Zone action but it does translate the days names from my language to english automatically.........

Anonymous
Not applicable

How to get week number?

This is the trick!

Hi, 

I have also used the same format time and as per my requirement I need output as day like "Monday" or "Tuesday" to set a delay .

I've tried the format date and time i'm able to retrieve date like 24,12 etc., but unable to get name of day.

Can you please suggest me a method to get It.

 

Thanks

@Vinod_babu 

To get the full day of week, use the 'dddd' date format string.  See my example below.

DayOfWeek1.pngDayOfWeek2.png

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Anonymous
Not applicable

Sorry everyone newbie here. Im struggling to get the right expression to work in a Create Event (4), to format a date.

 

I can get the date in the event from my Online Excel Sheet, by using the below expression but I can seem to find the right way to format it?? Would like it to appear in the body of the event as 'AUS Eastern Standard Time','dd/MM/yyyy HH:mm'

  • addDays('1900-01-01T00:00:00Z',sub(int(item()?['Task Allocation Date']),2))

Ive been able to use the below when adding a row to a table and it works but I cant seem to find the right string to use in an event??

  • convertTimeZone(Body('create_event_(v4)')?['CreatedDateTime'],'UTC','AUS Eastern Standard Time','dd/MM/yyyy HH:mm')

According to this page, where you currently have 'AUS Eastern Standard Time' you should have 'E. Australia Standard Time'.


But I will admit to not knowing anything about what an "event" is and what the formatting requirements are for it.

Anonymous
Not applicable

@ScottShearer, thank you! 

 

I have been looking everywhere trying to figure out how to add AM/PM to the timestamp... 

 

Those two little t's at the end did the trick! thank you! 

Anonymous
Not applicable

This does not work for me. I have two dates in excel that I am trying to pull into an email using Power Automate. I have tried using the formatDateTime expression and the addDays expression and neither are working for me. 

 

Currently if I try to just pull the date from the excel document and put it in the email it just returns a number like 44003 or something close to that.

 

Here's some of the things I have tried:

 

addDays("1899-12-30", int(body('Get_a_row_after_updates')?['When will the student licenses be installed?']), "d MMM yyyy")
 
addDays("1899-12-30", variables('startDate'), "d MMM yyyy") - in this case I created a variable called startDate where I convert the string from excel into an integer, rather than convert it into an integer in the formula, because that was giving me an error. 
 

formatDateTime(int(body('Get_a_row_after_updates')?['When will the student licenses be installed?']), "d MMM yyyy") - I've also tried this without the int. 

 

Why will none of these work?! It's the last thing I need to do for this flow. It should not be this hard!

Anonymous
Not applicable

@Anonymous 

 

I would suggest creating a new topic with your specific issue, including everything you wrote here, and adding what output you are getting after each of your attempts:

 

Are you getting errors in the flow or is it that the output is not what you want?

 

Also, include screenshots of your flow (your addDays action block, for example).

 

At first glance, I think I can say with certainty that formatDateTime() will not work here, as it requires the date being formatted be in a string format, so passing in the integer format from excel will not work with that expression.

 

It might be your reference to your data. If you're pulling from an excel table, then you're probably inside of an "Apply to each" loop, in which case you should use the items() expression passing in the name of the loop rather than body() passing in the name of the "Get Rows" action block.

 

Starting a new topic will give you a greater chance of receiving a response from someone who can help you in the forums, rather than responding to a topic that already has a solution.

 

thanks,

Kyle

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (1,360)