[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 272
  • Last Modified:

Validating date (12/31/2008 12:00:00 AM) with regular expression validator

The tag below validate date with mm/dd/yy format but cold not validate date such as this 12/31/2008 12:00:00 AM. How can I modify the tag to validate date such as this 12/31/2008 12:00:00 AM
<asp:RegularExpressionValidator ID="RegularValidatorEndDate" runat="server" ControlToValidate="txtEndDate"
                        ErrorMessage="Enter a valid End Date (i.e. mm/dd/yy)" ValidationExpression="^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$"
                        Display="Dynamic"></asp:RegularExpressionValidator>

Open in new window

0
Projack
Asked:
Projack
1 Solution
 
Daniel WilsonCommented:
Use a CompareValidator instead of a RegularExpresionValidator.  use the DataTypeCheck operator to require that it's a Date.

That will work MUCH better!
0
 
ProjackAuthor Commented:
I add no problem with date as I stated that this (mm/dd/yy worked without broblem The issue is how do I use the CompareValidator to validate 12/31/2008 12:00:00 AM format
0
 
GiftsonDJohnCommented:
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now