Number of working days inside one year

How can I calculate number of working days inside one year?

HI @Olivera_Kalinic

Have a look on the thread

Regards
Gokul

Without holidays (only MO-FR)

Enumerable.Range(0, new DateTime(2020,12,31).DayOfYear + 1).Select(Function (x) New DateTime(2020,1,1).AddDays(x)).Where(Function (x) Not (x.DayOfWeek = 0 OrElse x.DayOfWeek = 6 )).Count

Or

DaysCount = 
( From i Enumerable.Range(0, new DateTime(2020,12,31).DayOfYear + 1)
Let cday = New DateTime(2020,1,1).AddDays(x)
Where Not (cday.DayOfWeek = 0 OrElse cday.DayOfWeek = 6 )
Select d = cday).Count

new DateTime(2020,12,31), New DateTime(2020,1,1) can be replaced by prepared variables as well

Thank you :slight_smile:

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