title: Html5 type date - need full date value in database
body: <p>it is my html code </p>
  
  <pre><code>&lt;div class="required" id="join_form"&gt;
                      &lt;label for="DOB"&gt;DateOfBirth:&lt;/label&gt;
                      &lt;input type="date" name="date" id="date" required pattern="(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d" aria-required="true" aria-describedby="age-format" max="2004-12-31" min="1940-12-31" /&gt;
                      &lt;span id="age-format" class="help" align="center"&gt;Format: mm/dd/yyyy, mm-dd-yyyy, mm.dd.yyyy, mm dd yyyy&lt;/span&gt;
              &lt;/div&gt;
  </code></pre>
  
  <p>javascript to validate this type=date in other browsers </p>
  
  <pre><code>var mydate = document.getElementById('date'),
      mydateError = document.getElementById('age-format');
  
  mydate.addEventListener('input', function() {
      if (!mydate.value.match(/\d{4}-\d{1,2}-\d{1,2}/)) {
          mydateError.innerHTML = 'Please specify a valid date in the form 1940-2004 ';
          mydateError.style.display = 'inline-block;font-size:6pt;text-align:center;';
      } else {
          var value = new Date(date.value),
              min = new Date(date.min),
              max = new Date(date.max);
          if (value &lt; min || value &gt; max) {
              mydateError.innerHTML = 'Date has to be between ' + min.toDateString() + ' and ' + max.toDateString();
              mydateError.style.display = 'inline-block';
          } else {
              mydateError.style.display = 'none';
          }
      }
  });
  </code></pre>
  
  <p>php validation and insert for date</p>
  
  <pre><code>$DOB=mysql_real_escape_string($_POST['date']);
  
  $sql="INSERT INTO register(DOB) VALUES("$DOB");
  </code></pre>
  
  <p>i want to get whole date of birth like  mm/dd/year but in my database i am only getting year like 1970 or 1987 like that....i cant figure out where i got wrong  </p>