I would expect it to count the days between the two dates. When examining $dur with Data::Dumper I discovered that it only remembers the difference in months - and since it does not know which months are involved it cannot count the days.use DateTime; use Data::Dumper; my $date = DateTime->now; my $dur = $date->subtract_datetime( DateTime->now->subtract( years => +1, months => 1 ) ); print "\nmonths: " . $dur->in_units( 'months' ) . "\ndays: " . $dur->i +n_units( 'days' ) . "\n"; __OUTPUT__ months: 13 days: 0 ^^^^^^^
In reply to How can I count the days between two dates? by zby
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |