Convert duration to years?
biozic via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Jan 15 08:57:35 PST 2017
On Sunday, 15 January 2017 at 14:20:04 UTC, Nestor wrote:
> On Sunday, 15 January 2017 at 14:04:39 UTC, Nestor wrote:
>> ...
>> For example, take a baby born in february 29 of year 2000
>> (leap year). In february 28 of 2001 that baby was one day
>> short to one year.
>>
>> Family can make a concession and celebrate birthdays in
>> february 28 of non-leap years, but march 1 is the actual day
>> when the year of life completes. Which one to choose?
>>
>
> On second thought, if a baby was born in march 1 of 1999
> (non-leap year), in march 1 of 2000 (leap year) the age would
> have been one year plus one day (because of february 29).
No. A baby born on March 1st 1999 is just "one year old" on March
1st 2000, as it also is on March 2nd or any day after during the
same year.
> So perhaps the best thing is to always perform a "relaxed"
> calculation.
I guess the problem of people born on February 29th is really
application-dependent, and it also depends on the use of the
calculated age. A social web app: users probably would like to
see their age change on the 28th of non-leap years. A
regulation-aware software: just follow what the law says. Etc.
More information about the Digitalmars-d-learn
mailing list