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


Author: radhakrishnan01 Oct 2010 Member Level: Bronze   Points : 0

It's not working for year

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: