Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Compare two dates

by ablanke (Prior)
on Jul 22, 2019 at 19:39 UTC ( [id://11103162] : note . print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    if ($d2 >= $1) {
    
  2. or download this
    print "\n $d2 is greater or equal to  $d1\n";
    
  3. or download this
    DateTime->compare( $dt1, $dt2 )
    
  4. or download this
    use strict;
    use warnings;
    ...
        day       => 8,
        time_zone => 'America/Chicago',
    );
    
  5. or download this
    say DateTime->compare( $d1, $d2 ) > 0
        ? $d1->ymd .' is greater than ' . $d2->ymd 
        : $d2->ymd .' is greater or equal to ' . $d1->ymd;