how to calculate age in asp.net on button click event ? and the input of date of birth is taken from dropdownlist.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Sep 30, 2014, 9:58 AM
Selva GanapathyPosted Sep 30, 2014, 9:42 AM
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