I'm embarrassed to have to ask this question, but can't seem to find
an answer that works.

I have two dates.  I want to know the number of days between them.
Not days with years and months subtracted, just total days.  The
recipe I see for this on the web is this:

my $d1 = DateTime->today;
my $d2 = $d1->clone->subtract(years => 1);

my $dur = $d1->delta_days($d2);
print $dur->days . "\n";

However, that prints 2, not 365 as I hoped for.

Can anyone provide a way to do this without resorting to epoch seconds math?

- Perrin

Reply via email to