Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

The calendar thing is one those functions that you do use from day to day. Most of the time I have used Calendar::Calendar to generate a straight grid type, but you mentioned that this may no work for you.

There are formulas to calculate month length, but the easiest is to set up a table, zero relative of the month length. Thirty days as November, April, June, and September, the others, save February, have thirty-one. February....

In February a little math is necessary. It is a leap year, 29 day, if:

$is_leap_year = (($year % 4) == 0) && ((($year % 100) != 0) #<- fixed typo... || (($year % 400) == 0));

So, right to left, years that are divisible by 400 are leap years, years divisible by 100, but not 400, are not, other years, save those divisible by 100 before, that are divisible by 4 are, and what is left is not.

I hope was able to give you some timely information.

Good luck. -c

Updated to fix a typo... -c


In reply to Re: Simple calendar by chuckbutler
in thread Simple calendar by perl_fool

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-03-28 09:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found