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.
In reply to Re^7: Calculate Age, days to next and days from last for a given birthday
by ikegami
in thread Calculate Age, days to next and days from last for a given birthday
by ruzam
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |