in reply to Re^6: 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
Isn't converting years+months+days into a number exactly what (localtime)[7] does?
No, it only combines month and day, not year, month and day. Without taking the year into account, you need to work around leap years. I didn't have to. You have to, and you did, but incorrectly. (Years divisible by 4 are leap years, except those divisible by 100, except those divisible by 400.)
Actually, it just occured to me that both of our solutions have the following problems: They can't handle dates < Jan 1st 1970 or >= (some point in) 2038. Not very useful.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^8: Calculate Age, days to next and days from last for a given birthday
by ruzam (Curate) on Apr 29, 2006 at 17:01 UTC | |
by ikegami (Patriarch) on Apr 29, 2006 at 17:21 UTC | |
by ruzam (Curate) on Apr 29, 2006 at 17:57 UTC | |
by ikegami (Patriarch) on Apr 29, 2006 at 18:08 UTC | |
by ruzam (Curate) on Apr 29, 2006 at 20:18 UTC | |
by ruzam (Curate) on Apr 29, 2006 at 18:13 UTC |