PDA

View Full Version : JavaScript date validator.



rajug
06-14-2007, 10:13 AM
Is there any function in JavaScript which validates the date format like isNaN() for numbers? Or have anyone made such function which validates the date entered in the text box i.e. dd-mm-yyyy or yyyy-mm-dd or mm-dd-yyyy or dd/mm/yyy or mm/dd/yyyy or yyyy/mm/dd are only the valid dates??

Thank you in advance.

Veronica
06-14-2007, 02:15 PM
Try this:
http://www.smartwebby.com/DHTML/date_validation2.asp

You can also have people choose from dropdown options, limiting their choices to only the valid ones.
http://www.felgall.com/jstip48.htm

Twey
06-14-2007, 04:41 PM
Try:
isNaN(Date.parse(yourDate));Handles most date formats.