Find out when workday will be

Hi everyone!

I’d like your help with a development issue I came accross.

I need to determinate when the 3rd workday of the month will be.
Right now I can create a bollean to validate if today is the 3rd workday but I can’t find out when this day will be.

(From x In Enumerable.Range(0, now.Day).Reverse
Let dw = now.AddDays(-x).DayOfWeek
Where dw >= 1 And dw <= 5).Count = 3

The idea is:If today is smaller than 3rd workday AND bigger than 1st calendar day, skip worflow.

Many thanks,
Roberto

Hi,

Can you try the following expression?

Enumerable.Range(0,5).Select(Function(i) New DateTime(Now.Year,Now.Month,1).AddDays(i)).Where(Function(d) d.DayOfWeek<>DayOfWeek.Sunday AndAlso d.DayOfWeek<>DayOfWeek.Sunday)(3)

Regards,

Hi @Yoichi
Thank you for the solution. It works perfectly.
Best regards,

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.