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

Last weekday of the month

Hi,

 

I've been working on a Flow that has the function of sending an Excel sheet last weekday of every month.

 

I got most working but im struggeling with getting the below piece of the puzzle to function correctly. I need the function below to calculate the last weekday of the given month and display it as this: 2018-08-17T06:31 currently im getting the last day of the month not last weekday and an output looking like this: 2018-08-31T08:00:00.0000000Z so the red needs to be removed.

 

"@adddays(concat(add(int(formatDateTime(utcNow(), 'yyyy')),if(equals(formatDateTime(utcNow(), 'MM'), '12'), 1, 0) ),'-',add(int(formatDateTime(utcNow(), 'MM')),if(equals(formatDateTime(utcNow(), 'MM'), '12'), -11, 1) ),'-01T08:00Z'),-1)"

 Im using utcnow to let the function now what day, month and time it currently is.

1 ACCEPTED SOLUTION

Accepted Solutions
v-bacao-msft
Community Support
Community Support

Hi @ jimmyDK,

 

You could use the formatDateTime function to format your results to achieve the display you want.

 

Use the formatDateTime  function on the basis of your expression, as below:

 

formatDateTime(adddays(concat(add(int(formatDateTime(utcNow(), 'yyyy')),
                if(equals(formatDateTime(utcNow(), 'MM'), '12'), 1, 0) ),
                  '-',
                  add(int(formatDateTime(utcNow(), 'MM')),
                  if(equals(formatDateTime(utcNow(), 'MM'), '12'), -11, 1) ),'-01T08:00Z'),-1),'yyyy-MM-ddTHH:mm')

I have made a test on my side, as below:

8-19-1-flow.PNG

The result is as below:

8-19-1-run.PNG

Please take a try and let me know if any issue exists.

 

Best Regards,

Barry

Community Support Team _ Barry
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

1 REPLY 1
v-bacao-msft
Community Support
Community Support

Hi @ jimmyDK,

 

You could use the formatDateTime function to format your results to achieve the display you want.

 

Use the formatDateTime  function on the basis of your expression, as below:

 

formatDateTime(adddays(concat(add(int(formatDateTime(utcNow(), 'yyyy')),
                if(equals(formatDateTime(utcNow(), 'MM'), '12'), 1, 0) ),
                  '-',
                  add(int(formatDateTime(utcNow(), 'MM')),
                  if(equals(formatDateTime(utcNow(), 'MM'), '12'), -11, 1) ),'-01T08:00Z'),-1),'yyyy-MM-ddTHH:mm')

I have made a test on my side, as below:

8-19-1-flow.PNG

The result is as below:

8-19-1-run.PNG

Please take a try and let me know if any issue exists.

 

Best Regards,

Barry

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

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (3,973)