i was working with a simple table for calculating age of a user when he has entered in a text box and has to subtracted from the present time can you help me out.
Here is the Code i am Using to Calculate.
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
DateTime now = DateTime.Now;
DateTime givenDate = DateTime.Parse(DOB);
int days = now.Subtract(givenDate).Days;
int age = Math.Floor(days / 365.24219);
}
}
if is there any changes tell me i will change