In order to allocate enough space for an array element for each weekday of a year, I'm trying to work out the maximum number of rows I would need. That lead me onto the question of how I would work it out.
Would you have to calculate the number of days in every year for the next n years and go with that? Or is there (as I suspect) a more elegant solution involving the numbers 365, 366, 2 and 7?
Which libraries would help?
The maximum number of days in a year is 366, this gives us 52 full weeks. In those 52 weeks there are at least 52 * 5 = 260 weekdays.
We are left with 2 days (52 * 7 = 364), it is possible that these 2 days are weekdays.
So maximum number of weekdays in a year is 262.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With