Free Jobs
Reference




Dot Net Forums: ASPNET (77) C#.NET (39) VB.NET (8) AJAX (21) Silver Light (1) WCF (10) WPF (1) WWF (1) .NET 3.5 (3) SQL SERVER (38) Other (3)

Topic: validate DateTime as ddmmyyyy using regular expression validator in ASP.NET withleapyear

To get the Posted Questions details daily in your mail Click Here

Share this Post on Facebook/Twitter/Orkut Bookmark and Share





User: rajiv100 Post Date: 20 Jan 2012 00:34

Introduction:
How to validate DateTime as ddmmyyyy using regular expression validator in ASP.NET with
leapyear



Main Content:
To validate DateTime as mm dd yyyy using regular expression validator in ASP.NET

we can use Regular expression vlaidator

with below



ValidationExpression="^(((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))))$"



This regular will support leap year too.

Conclusion:
This way we can validate DateTime as ddmmyyyy using regular expression validator in ASP.NET with
leapyear



About Writer:
Hi,I am .NET Developer From Bangaloret


Writer's Link:

Writer's Email:







Comments:
Post Comment





Similar Articles Top ArticlesLatest Articles Other Articles by this Author







www.freejobsreference.com Copyright © 2009-2011 | All Rights Reserved
All content of this website is protected by copyright laws and should not be reproduced in any form or by any means without written permission
(Best viewed in IE 8.0+ or Firefox 3.0+ at resolution of 1024 * 768 or higher)