10
Answers

Calculate age In C#

Vijay

Vijay

8y
7.4k
1
Please can you help me in console application.
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



Thanks.
Answers (10)