Click here to Skip to main content
15,905,785 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please give me an idea how to validate this type of format using
regualar expression

dd/mm/yyyy hh:mm tt

Thank You
Posted

Hi dude,
use this code it will work

<code> <asp:RegularExpressionValidator ID="REV_txtDoj" runat="server" ErrorMessage="Give date in dd/MM/yyyy Format"
ValidationExpression="^(((((0[1-9])|(1\d)|(2[0-8]))\/((0[1-9])|(1[0-2])))|((31\/((0[13578])|(1[02])))|((29|30)\/((0[1,3-9])|(1[0-2])))))\/((20[0-9][0-9])|(19[0-9][0-9])))|((29\/02\/(19|20)(([02468][048])|([13579][26]))))$ "
ValidationGroup="Save" ControlToValidate="txtDoj" SetFocusOnError="true" Display="Dynamic"></asp:RegularExpressionValidator></code>
 
Share this answer
 
i dont want to validate in date only thare is a time also:

i want it, in this way dd/mm/yyyy hh:mm tt format

Thank you
 
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