On Thu, Jun 24, 2010 at 05:50:41PM +0200, "José M. Perea" wrote:
> 
> 
> Hello,
> 
> i'm using the DateTime::Format::Strptime perl module but I find an
> error calculating a period of time between two
> dates in timestamp format. This is my code:
> 
> *use DateTime::Format::Strptime;
> 
> my $fmt         = '%Y-%m-%d%t%H:%M:%S';
> my $parser      = DateTime::Format::Strptime->new(pattern => $fmt);
> 
> my $dt1 = $parser->parse_datetime("2007-01-01 01:04:39") or die;
> my $dt2 = $parser->parse_datetime("2007-01-02 01:05:09") or die;
> 
> my $diff = $dt2 - $dt1;
> print "\nPeriod of time:\n";
  print "\t".$diff->days, " days\n";
> print "\t".$diff->hours, " hours\n";
> print "\t".$diff->minutes, " minutes\n";
> print "\t".$diff->seconds, " seconds\n";
> 
> And the result is:
      1 days
>     0 hours
>     0 minutes
>     30 seconds *
> 
> Where is the problem?
> 
> Thanks!!

Ken

Reply via email to