using System.Globalization;
IFormatProvider ci= new CultureInfo("en-US", true);
DateTime Dt = Convert.ToDateTime(txtDateOfBirth.Text,ci);
string test = String.Format("{0:MM/dd/yyyy}", Convert.ToDateTime( Dt ));
int age = DateTime.Now.Subtract(DateTime.ParseExact(test, "dd/MM/yyyy", ci,DateTimeStyles.NoCurrentDateDefault)).Days / 365;
No comments:
Post a Comment