how to calculate age in asp.net on button click event ? and the input of date of birth is taken from dropdownlist.
Age claculation
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Selva GanapathyRank #560 · 4.3K reputationPosted Sep 30, 2014, 5:42 AM EDT
Hi Supriya Ladekar,
You can calculate age using DateTime as per the following code.
DateTime BirthDate = DateTime.Now;
DateTime TenYearOld = DateTime.Now.AddYears(10);
var Age = BirthDate.Subtract(TenYearOld);
Regards,
Selva Ganapathy K
VulpesRank #55 · 29.2K reputationPosted Sep 30, 2014, 5:58 AM EDT