Basically, I think the code is correct, but what about the lengths of the months? (30, 31, 29, or 28 days). Maybe it doesn't matter for your application, but if it does you have to add code for dealing with those special cases.

Here is what I have written so far, I tried to do it using Date::Time, but I'm not familliar with the module.
Hmm. Maybe you should do some experimentation with Date::Time to see what it can do. Or look for other Date:: modules. Date::Calc looks promising for your problem.

Not being familiar with a module is not really a good reason to not use it. Experiment with it and maybe someday a problem comes by which you can solve with that module because you knew it existed and played around with it.

Arjen


In reply to Re: date span in YYYYMMDD by Aragorn
in thread date span in YYYYMMDD by silent11

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.