jquery validate date of birth format dd-mm-yy

By Sam Deering

jquery validation for dob to specific format ie dd-mm-yy

    function(value, element) {
        return value.match(/^dd?-dd?-dd$/);
    "Please enter a date in the format dd-mm-yyyy.");
And then on your form add:
        rules : {
            myDate : {
                dateFormat: true
  • wilson


  • Vins

    Crap, who’ll check its a valid date?
    This will take 99-99-2014 as well

  • davethedev

    not working for me :( I get the validation error message but typing in a correctly formatted date doesn’t fix it

Because We Like You
Free Ebooks!

Grab SitePoint's top 10 web dev and design ebooks, completely free!

Get the latest in JavaScript, once a week, for free.