Timeline for Simple Age Calculator
Current License: CC BY-SA 3.0
3 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 21, 2014 at 12:36 | comment | added | comecme |
Assuming that in a leap year the birthday is on 28 February: thisYearBirthday = new DateTime(today.Year, birth.Month, birth.Day > DateTime.DaysInMonth(today.year, birth.Month) ? DateTime.DaysInMonth(today.year, birth.Month) : birth.Day) . But introducing a variable for DaysInMonth would be better. Maybe this would make the code not so simple anymore
|
|
Mar 18, 2014 at 11:52 | comment | added | svick | I just realized that this won't work if the birth date is on 29 February. Not sure how to fix that, while still keeping the code relatively simple. | |
Mar 17, 2014 at 23:28 | history | answered | svick | CC BY-SA 3.0 |