Saturday, April 11, 2009

To restrict date to mm/dd/yyyy format

The following code sample is a regular expression that can be used approriately to control date inputs to a particular format. In thise example, we restrict the user to enter date values in month/date/year format.

Take a regular expression validator Control and in validation expression write the following code


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

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home