I'm trying to generate a dynamic report showing default allocations for resources (in this case, Justices). The user has the option of choosing a report period of:

In any scenario, for example, "July - August", I need to start reporting from the first Monday's date in July, to the last Friday's date in August, with each cell in the report being one Mon - Fri week.

I have the stored procedure to fetch the data I need, I can populate the list of justices I need, but I CAN'T figure out an algorithm for getting the set of dates such that if the first day in July was a Thursday the breakdown would be:

     Thu 1 - Fri 2, Mon 5 - Fri 9, Mon 12 - Fri 16, etc.

Or if the first day was a Tuesday:

     Tue 1 - Fri 4, Mon 7 - Fri 11, Mon 14 - Fri 18, etc.

These dates are the headings above each cell of the report.

Any ideas?


In reply to Getting Weekly Dates by mothra

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.