use Date::Manip; $d=&DateCalc($start,$end); if($d eq "+0:0:0:0:2:0:0") #2 hours { print "two hours\n"; } else { print "not two hours\n"; }