We help IT Professionals succeed at work.

# regular expression for dd/mm/yyyy in C#.net

on
Hi

I want to  check the given data is in the Regular expression  dd/mm/yyyy  format or not using c#.net

Comment
Watch Question

## View Solution Only

Commented:
Use this regular expression

[0-3]{0,1}[0-9]\.[0-1]{0,1}[0-9]\.[0-9]{4,2}
BRONZE EXPERT
Top Expert 2011
Commented:
Try this

^(0[1-9]|[12][0-9]|3[01])[/](0[1-9]|1[012])[/](19|20)\d\d\$

Commented:
Try this
Java script
``````<script type="text/javascript" language="javascript">
function isValidDate(sText) {
//var re = /^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((19|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((19|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/((19|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))\$/;
var re= /^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((19|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((19|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/((19|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))\$/;
return re.test(sText);
}
function CheckDate() {
var oInput1 = document.getElementById("<%=txtDateValidation.ClientID %>");
if (isValidDate(oInput1.value)) {
} else {
}
}
``````

asp.net textbox and button
``````<asp:TextBox ID="txtDateValidation" runat="server"></asp:TextBox>
<br />
<asp:Button ID="btnSubmit" runat="server" Text="Submit it" OnClientClick="javascript:CheckDate();" />
``````
R & D Engineering Manager

Commented:

Commented:
It solved the Problem