Click here to Skip to main content
15,919,778 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi.. i want the date validation expression in dd-mm-yyyy format
Posted
Comments
OriginalGriff 2-Apr-12 4:51am    
That's nice for you!
What do you want to do with this expression?
Because until we know what you want to use it with, we can't tell what to give you.
Prasad_Kulkarni 2-Apr-12 4:53am    
Not clear. Give some more details.

hi vinod

rAre uyou doing this job in asp.net or c#.net .......
i hope that in asp.net
By using requiredfield validator we will achive this problem
XML
<asp:TextBox ID="txtDate" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="revDTTest" runat="server" ControlToValidate="txtDate" ForeColor="Red"
ErrorMessage="Enter Valid Date in dd/mm/yyyy format." SetFocusOnError="True" Display="Dynamic"
ValidationExpression="(^((((0[1-9])|([1-2][0-9])|(3[0-1]))|([1-9]))\x2F(((0[1-9])|(1[0-2]))|([1-9]))\x2F(([0-9]{2})|(((19)|([2]([0]{1})))([0-9]{2}))))$)"></asp:RegularExpressionValidator>


check this solution.......
thanks & regards,
nareshrajuu(hyd)
isoft, acsc company,
chennai
 
Share this answer
 
v2
Comments
fjdiewornncalwe 2-Apr-12 11:24am    
Please don't use text speak in your answers. You have a keyboard and the ability to type, so please use full words.
Hi ,
try this

ASP.NET
<asp:TextBox ID="TextBox1" runat="server">
        </asp:TextBox><asp:CompareValidator ID="CompareValidator1"
            runat="server" ErrorMessage="CompareValidator"
            ControlToValidate="TextBox1" Display="Dynamic" Operator="DataTypeCheck"
            SetFocusOnError="True" Type="Date"></asp:CompareValidator>

best regards
M.Mitwalli
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900