I consider these comments slightly off-topic, but highly relevant. Three types of error are common in dates input by users. ('.' or '-' rather than '/'. 2-digit rather than 4-digit years. and fields out of order) Use of such dates in a simple compare can lead to wrong results with no indication of error. Testing for the first two is so easy that there is simply no reason not to do it. It is not always possible to detect the third. The best that you can do is to verify that the date is valid and in a range that is "reasonable" for your application. Without modules, this may be more trouble than it is worth. A possible compromise is to verify that the month is less than 13 and the day is less than 32. This would detect about half of the errors and never reject a valid date.
Bill

In reply to Re: Comparing two dates without installing any modules by BillKSmith
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.