in reply to How can I count the days between two dates?

use DateTime; my $today = DateTime->today( time_zone => 'local' ); my $dur = $today->delta_days( $today->clone->subtract( years => 1, months => 1 ) ); print( $dur->in_units( 'days' ), " days\n" );

There's also ->delta_md if you want month+days instead of just days.

Replies are listed 'Best First'.
Re^2: How can I count the days between two dates?
by zby (Vicar) on Nov 05, 2008 at 09:50 UTC
    Thanks! delta_days did the trick.