in reply to Error while using "timelocal ()" function.
use strict; use warnings; use feature qw( say ); use DateTime::Format::Strptime qw( ); my $strp = DateTime::Format::Strptime->new( pattern => "%T %b %d %Y", locale => "en", time_zone => "local", on_error => "croak", ); my $year = "2011"; my $ownTime = $strp->parse_datetime("11:00:44 Aug 31"." ".$year); my $waitTime = $strp->parse_datetime("11:03:44 Aug 31"." ".$year); my $dur = $waitTime->delta_ms($ownTime); say $dur->minutes();
DateTime::Format::Strptime, DateTime, DateTime::Duration
|
|---|