try this code
<asp:textbox runat="server" id="TextBox1" xmlns:asp="#unknown" />
<asp:customvalidator runat="server" controltovalidate="TextBox1" errormessage="Date was in incorrect format" onservervalidate="CustomValidator1_ServerValidate" xmlns:asp="#unknown" />
Code Behind
protected void CustomValidator1_ServerValidate(object sender, ServerValidateEventArgs e)
{
DateTime d;
e.IsValid = DateTime.TryParseExact(e.Value, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out d);
}
DateTime.TryParseExact(e.Value, new[] { "dd/MM/yyyy", "yyyy-MM-dd" }, CultureInfo.InvarinatCulture, DateTimeStyles.None, out d);
Other Solution----------
public void Button1_Click(object sender, EventArgs e)
{
DateTime Test;
if (DateTime.TryParseExact(TextBox1.Text, "MM/dd/yyyy", null, DateTimeStyles.None, out Test) == true)
Response.Write("Date is Valid");
else
Response.Write("Invalid Date");
}