plz any one write code for to get age of a person in mvc4
plz any one write code for to get age of a person in mvc4.urgent
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.
Jayakumar BalasubramaniamPosted Aug 1, 2014, 10:35 AM
now code..
/////////////
int age=0;
age= ((DateTime.Now - DOB).TotalDays)/(365);
///////////
Explanation:
(DateTime.Now - DOB).TotalDays It will yield total days elapsed from his dateof birth to today and if we divide that count of days by 365, that is the age of the person.