Click here to Skip to main content
16,018,353 members
Articles / Web Development / ASP.NET

Find the count of a weekday between two dates without iterating/looping

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
17 Nov 2011CPOL 4.8K  
I like things simple for debugging purposes... LINQ implies a list or some iterable thing, but that's just me. I think this works:static int CountDayOcurrence(DateTime start, DateTime end, DayOfWeek day){ var wstart = start.AddDays(7 - (int) start.DayOfWeek); // Sunday after start...

Views

Daily Counts

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader Formulatrix
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions