html and php date input field
<p>I am having issues trying to figure out how, to create an html input box for the date:</p>

<p>like this:</p>

<p>YYYY-MM-DD</p>

<p>I was wondering if there is a better method of doing this than me manually creating 
something like this, and then using the - separators to separate the YYYY-MM-DD.</p>

<p>I will be using regex to do some validation after the user has entered the date of birth to make sure that it is greater than 21.</p>

<pre><code>&lt;label for="dob"&gt;Age (YYYY-MM-DD)&lt;/label&gt;
&lt;input id="dateofbirth" type="text" name="age" maxlength="10"/&gt;&lt;span&gt;*&lt;/span&gt;&lt;br /&gt;
</code></pre>

<p>Here is my regex for the date that will be inside function checkdate on the php side:</p>

<pre><code>return preg_match('/(\d{4})-(\d{2})-(\d{2}, $date);
</code></pre>

<p>Set date such that it will only take input from users over 21.
Currently this does not.<br>
    $date = '1974-12-03';</p>
