Example of Using a Date and Time Variable

Hi @balu,

Refer this
Age Calculation

DateTime birthday=new DateTime(1991,08,27)
String Age=Math.Round(Convert.ToDouble((((DateTime.Now.Year - birthday.Year) * 372 + (DateTime.Now.Month - birthday.Month) * 31 + (DateTime.Now.Day - birthday.Day)) / 372)),2).ToString

Output
Age : 26.5

Regards,
Arivu

3 Likes