I am looking for a regular expression to validation Date selected from a datepicker with format of D, dd M yy
$('#expirydate').datepicker({
constrainInput: true,
minDate: 0,
dateFormat: 'D, dd M yy'
});
And the equivalent format in View is like this:
<div class="editor-label">
Expiry Date
</div>
<div class="editor-field">
@Html.TextBox("ExpiryDate", String.Format("{0:ddd, d MMM yyyy}", DateTime.Now), new { id = "expirydate" })
@Html.ValidationMessageFor(model => model.ExpiryDate)
</div>
I could not get it in the regex library.. can anyone help??
Appreciate any feedback.. Thanks…
If it’s coming from a datepicker, and you trust that it won’t produce impossible dates, then to validate that format you could use: