I believe the real question is carefully concealed in this phrase:

based on the date how do I get the day of the week and display it.

That is, when the user asks to start the calendar at January 3, 2005, how do you know what day of th eweek that falls on so as to correctly format your calendar?

You need the Perl moduleDATE::CALC

which has the functions:

#returns the week number of the date input $week = Week_of_Year($year,$month,$day); #returns the date of the monday of the week input ($year,$month,$day) = Monday_of_Week($week,$year);
So you can do, (pseudo code):
- get $begin_day, $begin_month, $begin_year and $end_day, $end_month, +$end_year from form input $begin_week = Week_of_Year($begin_year,$begin_month,$begin_day); ($begin_year,$begin_month,$begin_monday) = Monday_of_Week($begin_week, +$begin_year); $end_week = Week_of_Year($end_year,$end_month,$end_day); ($end_year,$end_month,$end_monday) = Monday_of_Week($end_week,$end_yea +r); #note that in above month and year get changed in case the range strad +dles months or years - calculate $number_of_weeks in range either using a Date::Calc functi +on or $end_week - $begin week $monday_date = $begin_monday; for $w (1 .. $number_of_weeks) { print days-of-week row; print dates row starting at $monday_date for $r (1 .. $number_of_rooms) { get room data and print it; } $monday_date = $monday_date +7; }

Forget that fear of gravity,
Get a little savagery in your life.


In reply to Re: Unusual report by punch_card_don
in thread Unusual report by shilpam

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.