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->hours, " hours\n";
print "\t".$diff->minutes, " minutes\n";
print "\t".$diff->seconds, " seconds\n";

And the result is:
    0 hours
    0 minutes
    30 seconds *

Where is the problem?

Thanks!!
--

Reply via email to