difference in absolute days

[email protected] ("Perrin Harkins")
Newsgroups perl.datetime
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.