I'm confused by these methods in DateTime::Duration:
delta_days
days
in_units('days')
How are they different? When would one use each of them?
'delta_days' is apparently just the value you gave
for 'days' when constructing the object.
From its simple name, 'days' _looks_ like it is just
the 'days' value you passed to the constructor but is
actually something quite different.
in_units('days') again seems to just return
the days value you passed to the constructor.
But no... it also adds in 7*weeks.
my $dur = DateTime::Duration->new(
years => 3,
weeks => 4,
months => 1,
days => 23,
minutes => 24,
);
print $dur->delta_days(), "\n";
print $dur->days(), "\n";
print $dur->in_units('days'), "\n";
This prints
51
2
51
and so delta_days() is not just the value you passed, either.
I'm confused. When would one use these methods?
What practical problems would use each of them?