forum

Home / DeveloperSection / Forums / How to calculate age in c#?

How to calculate age in c#?

Anonymous User 2323 26-Oct-2014
How to calculate age from DOB
 class Personal{
 public DateTime DateOfBirth { get; set; }
 public string Age { get; set; }
 }
        Personal per=new Personal();
       Console.WriteLine("Enter the Date Of Birth :",per.DateOfBirth);        
 per.DateOfBirth = DateTime.Parse(Console.ReadLine());
 public string GetAge(DateTime DateOfBirth)
         {
        }
How can i write for function to calculate age from DOB and display
       Console.WriteLine("The DOB is" +DateOfBirth);
       Console.WriteLine("the Age is ...." +Age);
DOB is 04/02/1994
i want display age is 19 years, 6 months, and 9 days

c# c# 
Updated on 27-Oct-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By