Calculate Age from any Date

Rajesh_Kumar
Posted by Rajesh_Kumar under C# category on | Points: 40 | Views : 1448
DateTime cur_date = DateTime.Now;
DateTime dob = new DateTime(1991, 12, 25);
int age = new DateTime(cur_date.Subtract(dob).Ticks).Year;


Output would be:23

Comments or Responses

Login to post response