Sign in | Join
Last post 11-10-2009 12:33 AM by vizvin. 7 replies.
Sort Posts: Oldest to newest Newest to oldest
Hi,
What would be regular Expression for validating Date format like dd/MM/yyyy.?
Best Regards
Rameezwaheed:What would be regular Expression for validating Date format like dd/MM/yyyy.?
Regex: matches a date in dd/mm/yyyy format ^(((((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]))))$
Hi
Use this following Regular Expression Details, This will support leap year also.^(((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))))$Matches[29/02/2000], [30/04/2003], [01/01/2003] Non-Matches[29/02/2001], [30-04-2003], [1/1/1899]
or check this link http://www.codeproject.com/KB/aspnet/LengthValidation.aspx
http://www.java2s.com/Tutorial/JavaScript/0520__Regular-Expressions/UseRegularExpressiontovalidatedate.htm
Good Luck
google will give you 20400 results for your query
http://www.google.co.in/search?q=Regular+expression+for+validating+Date+format+dd%2FMM%2Fyyyy&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a
Hi Rameez,
Checkout http://regexlib.com/DisplayPatterns.aspx?cattabindex=4&categoryId=5
This is good site where you can find regular expressions to use for future http://regexlib.com/Default.aspx
Thanks,
Farooq
There is a very simple and nice way using ajax, ASP.NET AJAX MaskedEdit . Check this link http://www.asp.net/learn/ajax-videos/video-131.aspx
Thanks for all for shairing Ideas ,
I got it working and surely marked the post(s) as answer which helped me .
once again thanks for all.
I liked the leap year support.. Could you help me with a similar one?..my date format would be either "ddMMyyyy" or "MMddyyyy"
Thanks in advance.