Count days between two dates with Java 8 while ignoring certain days of week
Below I have 3 methods. The first is very simple. It just counts the total number of days. The second, however, will not only count the days, but will ignore the days of the week that are passed in to the method. My problem is that the third method is not always correct. It should match the second method. I am guessing it has something to do with leap years, because the difference is usually +=3|4 when it is incorrect. Additional Info I am attempting to mock Excel's weekday(serial_number,[return_type]) formula in a way. serial_number = startDate:Date - daysOfWeekToInclude:Array<Integer>