Days between two dates

Paul Makepeace at
Thu Dec 22 15:10:24 GMT 2005

A should-be-obvious question. How does one find the number of days
between two dates, without converting to epoch? (so I can do while
--$days >= 0) I thought ($end_dt - $start_dt)->in_units('days') would do
it but if the ::Duration ends up with a 'month' figure data is effectively
lost (which month? i.e. how long?) and then you can't convert to days.

Here's an example where there's a definite answer but DateTime loses
info by having its ::Duration use months:

 $ perl -MDateTime -le '
     $s=DateTime->new(year => 2005, month => 10, day => 1);
     $d=DateTime->new(year => 2005, month => 12, day => 1);


Paul Makepeace ..............................

"What is the word for octopus in polari? Swim and talk."

More information about the mailing list