Joshua Hoblitt schreef:
What you want is to normalize the values of a duration relative to
some fixed point in time. I agree this is something that we need to
do. Patches are welcome. :)
So if I read this correctly the answer is at this time what I'm after
is not possible with
On Sat, 23 Aug 2003, Eugene van der Pijll wrote:
The only problem is that DT::subtract_datetime doesn't use it. It
probably should. (It would be even better if there was an option to
calculate the difference in days secs. But the default should probably
be to return a difference of months,
The only problem is that DT::subtract_datetime doesn't use it. It
probably should. (It would be even better if there was an option to
calculate the difference in days secs. But the default should probably
be to return a difference of months, days, minutes, seconds.)
I think the default
I'm not sure if I'm doing something really wrong or if things are
broke but with this code:
#!/usr/bin/perl
use DateTime;
$birth=DateTime-new(year=1968,month=6,day=28);
print $birth-ymd.\n;
$today=DateTime-today;
print $today-ymd.\n;
$age=$today-$birth;
print $age-years.\n;
I get this output:
Hi Mattew,
$birth=DateTime-new(year=1968,month=6,day=28);
print $birth-ymd.\n;
$today=DateTime-today;
print $today-ymd.\n;
$age=$today-$birth;
print $age-years.\n;
$age is a DateTime::Duration object. Unfortunately math with these object can be a
little non-intuitive.
I get this
Again I fail to see the logic or even value in the DateTime::Duration
behaving as above. But, I'm sure I'm probably just missing something
important.
Durations are independent of dates and times.
The only one that does makes since is Deltas but only
because it is returning a hash that has
Perhaps I'm just approaching this all wrong. I'm just looking for a
simple way to compute some ones age today.
What you want is to normalize the values of a duration relative to
some fixed point in time. I agree this is something that we need to
do. Patches are welcome. :)
So if I read this