jabowery has asked for the wisdom of the Perl Monks concerning the following question:
main::(a.pl:49): my $first_time_date_time=DateTime::Format::ISO8601 +->parse_datetime($first_time); + + DB<2> p $first_time 2013-08-01T20:10:31 + + DB<3> n main::(a.pl:50): my $last_time_date_time=DateTime::Format::ISO8601- +>parse_datetime($last_time); + + DB<3> p $last_time 2013-08-06T20:09:34 + + DB<4> n main::(a.pl:51): my $duration=$last_time_date_time->subtract_dateti +me($first_time_date_time); + + DB<4> main::(a.pl:52): my $days=$duration->days; + + DB<4> p $duration DateTime::Duration=HASH(0x1a2f268) + + DB<5> p $duration->in_units('days') 4 + + DB<6> x $duration->deltas() 0 'months' 1 0 2 'days' 3 4 4 'minutes' 5 1439 6 'seconds' 7 3 8 'nanoseconds' 9 0 + + DB<7> $d=$last_time_date_time->delta_days($first_ +time_date_time) + + DB<8> p $d DateTime::Duration=HASH(0x1e1e2e8) + + DB<9> p $d->in_units('days') 5
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Inconsistent results of subtraction with DateTime?
by rjt (Curate) on Aug 07, 2013 at 19:37 UTC | |
|
Re: Inconsistent results of subtraction with DateTime?
by Anonymous Monk on Aug 07, 2013 at 19:08 UTC | |
by jabowery (Beadle) on Aug 07, 2013 at 21:09 UTC |