Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Validation

Status
Not open for further replies.

jl280328

Programmer
Jun 15, 2006
97
US
Hi I am validating a dates put in by a user and I am almost done, but the only problem I run into is that if the user puts in a value like 3/32/06 it gets converted to a date of April 1st. I tried to use the getMonth function to compare the before and after the conversion but it won't let me do this until I convert it to a date. Is there anyway to send an error instead of having it convert the date to a day of the next month?
 
Perhaps you could parse out the day entered and throw an error if it's greater than 31. Otherwise you could store the month entered and compare that with the month after the date conversion, if they don't match you've caught an error.
 
yes I have seen some nice scripts on doing this but the only problem is that we don't want to restrict the user to a give format such as mm/dd/yyyy or something like that for example the default value in the text box for today would be
Dec 19 2006
but the user could also enter in 12-19-2006 or something along these lines.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top