Or, if you happen to have the dates already in timet format, you can just write the subroutine yourself; it's quite short.  It takes less time than downloading any modules, and you have the fun of doing it yourself, as well as learning how to do it.

Here's a working example:

# Inputs: $1 ... date 1, as a timet # $2 ... date 2, as a timet # # Outputs: $1 ... nonzero if the dates match, ignoring the actual tim +es # of day for each, zero if they are different. # sub same_date { my ($timestamp1, $timestamp2) = @_; my ($day1, $month1, $year1) = (localtime $timestamp1)[3,4,5]; my ($day2, $month2, $year2) = (localtime $timestamp2)[3,4,5]; return ($day1 == $day2 && $month1 == $month2 && $year1 == $year2); }

@ARGV=split//,"/:L"; map{print substr crypt($_,ord pop),2,3}qw"PerlyouC READPIPE provides"

In reply to Re: How to compare two dates (any format)? by liverpole
in thread How to compare two dates (any format)? by Anonymous Monk

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.