in reply to Re: How Many Mondays in Date Range?
in thread How Many Mondays in Date Range?

This works very well. It doesn't require a lop larger than 7. But I take out the -1 to get

$daycounts[($firstday+$_)%7] = int(($days+6-$_)/7) for(0..6);

And get an array where Monday is 0 and Sunday is 6. This way I can use the UnixDate result -1 to match it to this result.

-Travis

Replies are listed 'Best First'.
Re: Re: Re: How Many Mondays in Date Range?
by suaveant (Parson) on Aug 02, 2001 at 18:29 UTC
    I put the -1 in because you said $firstday went from 1-7, was I wrong?

                    - Ant

      Oh, not at all. But everyone brought up a good point that I was wasting the 0 position of the array. Besides, it is just as easy to subtract 1 from the UnixDate result when I ask how many Tuesdays there were.

      You weren't wrong, I was just stuck on using 1..7. I should've shifted to 0..6.

      -Travis