How to get first working day of Next month (Should not be weekend)

Hi All,

How can I get first working day of next month ? It should not be Saturday or Sunday.
Any help will be appreciated.

Thank You

@Chetan_Wagh

Please try this

new DateTime(Now.AddMonths(1).Year, Now.AddMonths(1).Month, 1).AddDays(If(new DateTime(Now.AddMonths(1).Year, Now.AddMonths(1).Month, 1).DayOfWeek.ToString.Equals("Saturday"),2,If(new DateTime(Now.AddMonths(1).Year, Now.AddMonths(1).Month, 1).DayOfWeek.ToString.Equals("Sunday"),1,0)))

image

cheers

1 Like

Hi,

Can you try the following expression?

Enumerable.Range(1,3).Select(Function(i) New DateTime(Today.Year,Today.Month,i).AddMonths(1)).Where(Function(d) d.DayOfWeek<>DayOfWeek.Sunday AndAlso d.DayOfWeek <> DayOfWeek.Saturday).First()

The above returns DateTime type, please add .ToString if necessary

Regards,

2 Likes

Hey @Chetan_Wagh

image

Date forum.zip (44.0 KB)

Hope this is helpful
Cheers,

6 Likes

Thanks a lot @Anil_G. !

1 Like

Thank you so mucjh @Yoichi :smiling_face:

1 Like

Superb. Thanks a ton @Chirag_Shetty_Divakar :smiling_face:

1 Like

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