Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: Compare two dates

by soonix (Canon)
on Jul 22, 2019 at 21:40 UTC ( [id://11103172] : note . print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    say DateTime->compare( $d1, $d2 ) 
        ? $d1->ymd .' is greater than ' . $d2->ymd 
        : $d2->ymd .' is greater or equal to ' . $d1->ymd;
    
  2. or download this
    say $d1->ymd . ' is ' . ('earlier than', 'equal to', 'later than')[Dat
    +eTime->compare( $d1, $d2 ) + 1] . ' ' . $d2->ymd;