Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^4: Calculate Age, days to next and days from last for a given birthday

by ruzam (Curate)
on Apr 29, 2006 at 05:03 UTC ( [id://546469]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Calculate Age, days to next and days from last for a given birthday
in thread Calculate Age, days to next and days from last for a given birthday

I thought the category 'fun stuff' was obvious....

I take great pride in my code (even if it's sometimes wrong).

I also spent the better part of 1997 thru 1999 fixing broken mainframe date code for a living. If you want to compare a 30 year old 2 digit year problem to a 100 year old leap year problem I think there's a baby/bath-water comparison that could be made. For all you know, by 2100 the leap year rule may be changed into another exception just to prevent computer leap year problems from popping up! (if we're even using the same calendar system by then)

The code I've written here specifically uses current date +/- 1 year. Without rewriting portions of it, it will never see 1900. You, me and everything we know and believe about computers will be long since dead and turned to dust before this code ever sees 2100. So the scenario of someone using this snippet untouched for either of those years is not even a probability. That's the beauty of the 2000 'exception'.

The code as written (pending some revisions) will happily work with any birthdate of any year. You can use any number that Perl will accept for the birthdate year, it isn't even passed to a date function of any kind. There is no provision to provide any date other than the current date. To make such a modification would require more careful attention to leap years as you've suggested. It would also not be the code I wrote.

The point of my writing it was to avoid using Date::Calc. If Date::Calc were a core module I might have considered it first but it's not. There are times when you can't just pick the module of your dreams and toss it into the script.
  • Comment on Re^4: Calculate Age, days to next and days from last for a given birthday

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://546469]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2024-04-20 03:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found