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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

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.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (5,129)