in reply to Re: Older people should know their age on Mercury
in thread Older people should know their age on Mercury

Yes, that is a better way of doing it, except that Date::Calc is 1-based in it's months instead of 0-based, So if you wanted to find out for a person born in October, you would need to set $birthMonth to 10.

I find that to be an annoying feature of Date::Calc. That and the way it sets up the days of the week as (1..7) = (Monday .. Sunday). The pod sites all sorts of ISO specs that say this is the way it should be. Unfortunately, localtime and timelocal don't agree. This means an enormous opportunity for off-by-one errors if you need to switch back and forth.
  • Comment on Re: Re: Older people should know their age on Mercury

Replies are listed 'Best First'.
Re: Re: Re: Older people should know their age on Mercury
by Sweeper (Pilgrim) on Oct 03, 2001 at 09:41 UTC
    This 0..11 rang for months is a wart inherited from C. I am amazed it is still there in Perl 5. Same thing for year 101 instead of 2001. Fortunately, most modules have correct ideas about date elements. Fortunately too, there is RFC 48 for Perl 6, that will fix the warts.
Re: Re: Re: Older people should know their age on Mercury
by thunders (Priest) on Oct 03, 2001 at 08:00 UTC
    You are correct. It seemed to work until I put in 0 for a January date. That's an invalid argument for the Delta_Days function. which means I also have to add one to localtime->mon() as well. Cause the Time::localtime module starts it's indices at zero. Quite Inconsistent. Thanks.