in reply to Re^4: 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
But I'm still confused as to the need to convert to seconds.
You can't do arithmetic on years+months+days. Just like you can't do arithmetic on degrees+minutes+seconds. You need to convert it into a number.
I could have converted every date into the number of days since an arbitrary day, but there's no existing function to do that (or the inverse operation). Doing it manually would force me to handle leap seconds, leap days, oddly numbered months, etc.
On the other hand, there's already a function (timegm) to convert a date into the number of seconds since an arbitrary second (Jan 1st, 1970, 0:00:00), and there's already a function which does the inverse operation (gmtime).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Calculate Age, days to next and days from last for a given birthday
by ruzam (Curate) on Apr 29, 2006 at 03:54 UTC | |
by ikegami (Patriarch) on Apr 29, 2006 at 05:58 UTC | |
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 | |
|