Write this code in the aspx page or in the utility file.
private bool ValidateDate(string date) { bool isDateValid = true; try { IFormatProvider culture = new CultureInfo("fr-FR", true); DateTime.ParseExact(date, "dd/MM/yyyy", culture); } catch (Exception exceptionObject) { isDateValid = false; } return isDateValid; }
// call the function passing with a date
No comments:
Post a Comment