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
Register for a Free Workshop.png

Register for a Free Workshop

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

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (1,955)