use warnings; use strict; use DateTime; use DateTime::Format::Strptime; my $strp = DateTime::Format::Strptime->new(on_error=>'croak', pattern => '%a %b %d, %Y - %H:%M:%S', time_zone => 'UTC'); my $dt = $strp->parse_datetime('Tue Oct 23, 2018 - 19:57:12'); print $dt->strftime('%Y-%m-%d %H:%M:%S %z'), "\n"; my $dt_one_day_ago = DateTime->now->subtract(days=>1); print "$dt is ", $dt < $dt_one_day_ago ? '<' : '>=', " $dt_one_day_ago\n";