cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

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
Super User III
Super User III

@Kamel- 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

22 REPLIES 22
Super User III
Super User III

@Kamel- 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

Worked like a charm! Thank you so much!

Frequent Visitor

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

View solution in original post

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')

Frequent Visitor

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?

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

 

 

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. 

Advocate II
Advocate II

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.

@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! 

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!

Responsive Resident
Responsive Resident

@alexaRo 

 

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 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.

Users online (13,448)