Flavio, is there already a method to determine the number of elements in
a DateTime::Set?
If not, I can currently make it as_list, and then get the length of the
list, but it would be cleaner to have a method to do this.
Cheers!
Rick
The new Event-Easter has been uploaded to CPAN and should be available
shortly. This release fixes the issue raised by Ron Hill concerning
sets. Basically sets weren't being tested so the problem never showed
its head. The sets test was just a duplicate of the lists test! All
fixed now though!
Che
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
> Flavio, is there already a method to determine
> the number of elements in a DateTime::Set?
>
> If not, I can currently make it as_list, and then
> get the length of the list, but it would be
> cleaner to have a method to do this.
What would be a name for this method?
There is no accessor ye
--- Rick Measham <[EMAIL PROTECTED]> wrote:
> Flavio, is there already a method to determine the
> number of elements in
> a DateTime::Set?
>
> If not, I can currently make it as_list, and then
> get the length of the
> list, but it would be cleaner to have a method to do
> this.
There is an in
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.
On Mon, 2003-08-18 at 02:37, [EMAIL PROTECTED] wrote:
> > Flavio, is there already a method to determine
> > the number of elements in a DateTime::Set?
> >
> > If not, I can currently make it as_list, and then
> > get the length of the list, but it would be
> > cleaner to have a method to do thi
> 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 h
Try:
print $age->deltas, "\n";
If the output from that doesn't look right to you please send it on
to the list.
Code (DateTime is the current version available from CPAN):
#!/usr/bin/perl
use DateTime;
$birth=DateTime->new(year=>1968,month=>6,day=>28);
print $birth->ymd."\n";
$today=DateTime-
> 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
10 matches
Mail list logo