Date Validation Expression and Leap Year

  • Thread starter Thread starter Hai Nguyen
  • Start date Start date
H

Hai Nguyen

I want to validate a textbox with date in the right format. I already have
it worked. However, my validation expression does not solve the # of days in
Feb; for isntance it does not solve for leap year like on Feb there are
maybe 28 or 29 days

Thank for any help
 
Hai Nguyen said:
I want to validate a textbox with date in the right format. I already have
it worked. However, my validation expression does not solve the # of days in
Feb; for isntance it does not solve for leap year like on Feb there are
maybe 28 or 29 days

Thank for any help

I am guessing (as you didn't specify it) that you are using a
RegularExpressionValidator
and that you want a RE that correctly checks for leapdays.
That can't be done (or at least not without a very complicated RE).
You already have a RE that checks if the string "looks like it could be a
date".
You could add a CustomValidator with server-side code that checks if it is
a real date ("does DateTime.Parse accept it?") and even add a client-side
function that does the same.

Hans Kesting
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Set Up Calendar To Account For Leap Years 2
define leap year 1
Handling Leap Years 3
Access 2003 - Leap year 2008 1
How to Handle Feb 28 and 29? 2
Leap Year 3
2008 Leap Year 4
Excel DateDif - why does 2007 seem different? 3

Back
Top