This functionalty is taken care of in the Date::Calc module. Date::Calc can do all of your date caclulations without the running your dates through sprintf or worrying about 24 hour formats or worrying about 2/4 digit years.

Else if you really want down to the second comparisions then just use epoch seconds. Epoch seconds are the native format for localtime.

I would highly recommend reading some of these nodes before you post again:
  • Before you post...
  • turnstep's home node
  • How to ReadTheFineManual

  • Understanding these posts will make your stay at the Monastery more enjoyable.

    Understanding why you should not reinvent good wheels will make your career more enjoyable.

    grep
    grep> rm -f /bin/laden

    In reply to Re: Comparing Dates by grep
    in thread Comparing Dates by joshua

    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.