date validation?

N

Null

How to write an IsDate function that actually checks for a particular date
format?

Using try-catch on Convert.ToDateTime(sDate) doesn't catch invalid entry
(i.e. 5/2000).....I want the dates to be input as mm/dd/yyyy OR m/d/yyyy OR
m/d/yy (etc.)....

Any thoughts?
 
A

Alvin Bruney

a regex would come in handy here http://regexlib.com/
or do a cheesy
System.DateTime myDateTime = DateTime.Parse(testString);

and check myDateTime for validity. I prefer regex though
 

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

Something is wrong 1
date validation 1
Validate date 6
DATE Format 2
Need help with this script 4
Range validation and international date formats 1
Date Validation 12
Date validation 4

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top