jfrm has asked for the wisdom of the Perl Monks concerning the following question:
Normally by re-reading the documentation repeatedly, eventually, I get it. But not this time.
my $startdt = DateTime->new(day => 1, month => 4, year => 2007); my $enddt = DateTime->new(day => 22, month => 10, year => 2007); my $duration = $startdt->delta_days($enddt); my $numdays = $duration->days; print "Test: Number of days in period :$numdays (".$startdt->dmy('/'). +" - ".$enddt->dmy('/').")<Br>";
Result
Test: Number of days in period :1 (01/04/2007 - 22/10/2007)
Can anyone enlighten (if you'll excuse me using the term so thoughtlessly in a temple) me as to how I might get the correct duration in days and why this result is only 1?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: A DateTime penance has befallen me
by ikegami (Patriarch) on Oct 22, 2007 at 18:08 UTC | |
Re: A DateTime penance has befallen me (weeks)
by tye (Sage) on Oct 22, 2007 at 18:08 UTC | |
Re: A DateTime penance has befallen me
by Krambambuli (Curate) on Oct 22, 2007 at 19:33 UTC |
Back to
Seekers of Perl Wisdom