title: jQuery Validation Engine : Change Date Format
body: <p><strong>My Datepicker code</strong></p>
  
  <pre><code>$(function(){ 
  
           $( "#task_start_date").datepicker({
           dateFormat: 'dd-M-yy',
           showOn: 'button',
           buttonImage :image_us,
           buttonImageOnly: true
          });
  });
  </code></pre>
  
  <p><strong>HTML Input:</strong></p>
  
  <pre><code>&lt;input type="text" class="form-control validate[required,custom[date]]" name="task_start_date" id="task_start_date" /&gt;
  </code></pre>
  
  <p><strong>JS function for Correct Date input validation:</strong></p>
  
  <pre><code>"date": {                    
                      //  Check if date is valid by leap year
              "func": function (field) {
                      var pattern = new RegExp(/^(\d{4})[\/\-\.](0?[1-9]|1[012])[\/\-\.](0?[1-9]|[12][0-9]|3[01])$/);
                      var match = pattern.exec(field.val());
                      if (match == null)
                         return false;
  
                      var year = match[1];
                      var month = match[2]*1;
                      var day = match[3]*1;                   
                      var date = new Date(year, month - 1, day); // because months starts from 0.
  
                      return (date.getFullYear() == year &amp;&amp; date.getMonth() == (month - 1) &amp;&amp; date.getDate() == day);
                  },                      
               "alertText": "* Invalid date, must be in YYYY-MM-DD format"
                  },
  </code></pre>
  
  <p>Here the <code>regex</code> expects <code>YYYY-MM-DD (2014-11-26)</code> format but we are using <code>dd-M-yy(01-MAR-12)</code> format. </p>
  
  <p><strong>Regex Tried:</strong></p>
  
  <pre><code>/^(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[012])[\/\-]\d{4}$/
  </code></pre>
  
  <p>The above <code>regex</code> did not work. How can I change the <code>regex</code> to match the expected datepicker output. The value inserted in DB is <code>01-MAR-12</code> and not <code>2014-11-26</code>.</p>
  
  <p>Thanks.</p>