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

How do I format the date in the standard template (Create a daily summary of Planner tasks by bucket)

Step 1Step 1Step 2Step 2Step 3Step 3Step 3 & 4Step 3 & 4Step 5 & 6Step 5 & 6Step 7 & 8Step 7 & 8Step 9 & 10Step 9 & 10Step 11 & 12Step 11 & 12Step 13, 14, 15Step 13, 14, 15Step 16Step 16

 

hello,

I am new to flow and I am using the standard template "Create a daily summary of planner tasks by bucket" I cannot figure out how to get the date to format to MM/dd/yyyy rather than the string that is coming over 2019-04-30T10:00:00Z.

 

I have tried all of the previous suggestions on this forum. Not sure if I am just not putting it in the right place. I also have 3 fields that I need to convert the time.

 

StartDate

DueDate

CompletedDate

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @cmr579 ,

 

Please take a try with the following code, which will return blank if the item is empty, otherwise, return its exact date.

if(empty(items('Iterate_through_tasks')?['completedDateTime']),'',formatdatetime(items('Iterate_through_tasks')?['completedDateTime'],'MM/dd/yyyy'))

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5

@cmr579 

Hi there, welcome!

 

Check out this thread and let us know if that helps.

 

-Ed-

v-yamao-msft
Community Support
Community Support

Hi @cmr579 ,

 

Do you want to format the StartDate, DueDate, CompletedDate to format of “MM/dd/yyyy”?

 

In the action Set TaskDetails variable, please set them separately with the following functions:

StartDate:

formatdatetime(items('Iterate_through_tasks')?['startDateTime'],'MM/dd/yyyy')

DueDate:

formatdatetime(items('Iterate_through_tasks')?['dueDateTime'],'MM/dd/yyyy')

CompletedDate:

formatdatetime(items('Iterate_through_tasks')?['completedDateTime'],'MM/dd/yyyy')

 

I have tested it on my side successfully.

1.PNG

 

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I added the content that you provided and I think it brought me alot closer. However, it failed because I do have some values which are null meaning they may not have start dates, due dates or completed dates. Do you have a recommendation to write to include strings that have no dates?

 

I am attaching the error message I received. action item 11.JPG

Hi @cmr579 ,

 

Please take a try with the following code, which will return blank if the item is empty, otherwise, return its exact date.

if(empty(items('Iterate_through_tasks')?['completedDateTime']),'',formatdatetime(items('Iterate_through_tasks')?['completedDateTime'],'MM/dd/yyyy'))

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I'm having the same issue as OP, and am working through the suggestions in this thread. I tried the suggestion for the "formatdatetime" variables, and ran into the same problem with my flows as I do have Null values. I then went on to try Mabel's "if" code, but im getting the error "enter a valid json". Does anyone have any further ideas how this might be achievable?

 

I've done a bit of trawling and can see generally how you could go about formatting dates, but haven't been able to work out a way to do this within this flow's Set TaskDetails variable. Thanks!

Tom

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (1,388)