One could also let the user specify which date format they are using. It may even have field escapes to build a format like the date(1) command. Yet another option is to allow for year, month, and day arguments (-fromday -frommonth -fromyear -tomonth -today -toyear). One could also document ISO 8601 dates are taken by the program and reject anything that isn't one. There might be a Unix epoch timestamp option.

I find it odd that you would call using '-' as a separator an error. ISO 8601 demands it. The standard also works with week numbers and day-of-year numbers which can be quite handy sometimes. When writing new software which doesn't have to deal with legacy formats, I generally try to use a standard. If you're going to force a particular format, don't use one that encourages localization nightmares.


In reply to Re^2: Comparing two dates without installing any modules by mr_mischief
in thread Comparing two dates without installing any modules by G Nagasri Varma

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.