Validate Date | JavaScriptSource

Validate Date

Torsten Frey Dec 28, 2001
This is a simple date validation. The script is written for the European format (ddmmyy), but can easily be changed.
Enter Date (Use European format shown at right)

(Date is validated after leaving the field.)

ddmmyy (171201) or
ddmmyyyy (17122001) or
ddXmmXyy (17-12-01 or 17y12q01 ... ) or
ddXmmXyyyy (17.12.2001 or 17,12,2001 ...)
where "X" is any sign not in 0..9, i.e. "-" or "/"

The JavaScript Source: Forms: Validate Date

Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Command-s). The script is yours!!!


Did you use this script?  Do you like this site?  Please link to us!

Leave a Response

1 comment)

Hi, change leap calculation line to if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) { leap = 1; } then it will work correctly. best regards, nico

Nico Feb 1, 2013