Users Pricing

forum

Home Forums How to calculate age in c#? – MindStick

How to calculate age in c#?

Anonymous User 2868 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

1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md