private static int CalculateAge(DateTime DOB) { int age = 0; age = DateTime.Now.Year - DOB.Year; if (DateTime.Now.DayOfYear < DOB.DayOfYear) age = age - 1; return age; } protected void Calendar1_SelectionChanged1(object sender, EventArgs e) { txtbox2.Text = Calendar1.SelectedDate.ToString(); //int CalculateAge() Calendar1.Visible = false; txtAge.Text= CalculateAge() }
Calendar1.SelectedDate
DateTime
DateTime txtMyDate = DateTime.ParseExact(txtbox2.Text, "M/d/yyyy", CultureInfo.InvariantCulture);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)