title: CI Form Validation of Date. with input type="date"
body: <p>validating a form with that has an input type=&quot;date&quot; which takes input mm/dd/yyyy
  however if i var_dump the results it comes out as yyyy-mm-dd.</p>
  <h1>1 do I validate the input type &quot;mm/dd/yyyy&quot;, or do i validate &quot;yyyy-mm-dd&quot;.</h1>
  <p>---im assuming I validate what the var_dump gives me which is yyyy-mm-dd.</p>
  <h1>2 More importantly I am having a hard time finding out the simplest way of going about validating date.</h1>
  <p>---I am not sure how to go about validating the date without going through by hand and checking every single date. Is there some built in functions that I could use, and how would I go about implementing that in with my CI form validations I already have.</p>
  <pre><code>function check_registration($post_data)
      {
          // Validations:
          // first_name
          $this-&gt;form_validation-&gt;set_rules('first_name', 'First Name', &quot;trim|required&quot;);
          // last_name
          $this-&gt;form_validation-&gt;set_rules('last_name', 'Last Name', &quot;trim|required&quot;);
          // email
          $this-&gt;form_validation-&gt;set_rules('email', 'Email', &quot;trim|required|valid_email|is_unique[users.email]&quot;);
          // password
          $this-&gt;form_validation-&gt;set_rules('password', 'Password', &quot;trim|required|min_length[6]&quot;);
          // confirm_password
          $this-&gt;form_validation-&gt;set_rules('confirm_password', 'Confirm Password', &quot;trim|required|matches[password]&quot;);
          // DOB
          $this-&gt;form_validation-&gt;set_rules('DOB', 'Date of Birth', &quot;trim|required&quot;);
  
          // run validations:
          if ($this-&gt;form_validation-&gt;run() === False)
          {
              // set flash data errors
              $this-&gt;session-&gt;set_flashdata(&quot;reg_first_name_error&quot;, form_error('first_name'));
              $this-&gt;session-&gt;set_flashdata(&quot;reg_last_name_error&quot;, form_error('last_name'));
              $this-&gt;session-&gt;set_flashdata(&quot;reg_email_error&quot;, form_error('email'));
              $this-&gt;session-&gt;set_flashdata(&quot;reg_password_error&quot;, form_error('password'));
              $this-&gt;session-&gt;set_flashdata(&quot;reg_confirm_password_error&quot;, form_error('confirm_password'));
              $this-&gt;session-&gt;set_flashdata(&quot;reg_DOB_error&quot;, form_error('DOB'));
              redirect('/');
          }
          // No errors:
          else
          {
              $this-&gt;insert($post_data);
              redirect('/success');
  
          }
      }
  </code></pre>
  <p>Thanks in advance.
  <br/>
  -Ants</p>