How to validate HTML5 date format
<p>I want to use the HTML5 date input field</p>

<pre><code>&lt;input type='date' name='customDate'&gt;
</code></pre>

<p>So that other users can make use of the build-in datepicker from their browser.</p>

<p>I would like to check if the input is actually in date format. As I found here: <a href="https://stackoverflow.com/questions/7372038/is-there-any-way-to-change-input-type-date-format">Is there any way to change input type=&quot;date&quot; format?</a> there is no unique presentation format. For example, in Chrome the input of the date field is given in the form of <strong>dd.mm.yyyy</strong> and in Firefox 24 or IE 9/10 the date in the input field is presented as <strong>YYYY-MM-DD</strong>.</p>

<p>My first problem is, how do you tell the user in which format you want him to type in the date? In Firefox I would need something like</p>

<pre><code>&lt;label&gt;Enter Date(YYYY-MM-DD)&lt;/label&gt;&lt;input type='date' 
                                         name='customDate' placeholder='YYYY-MM-DD'&gt;
</code></pre>

<p>But this would be wrong for Chrome.</p>

<p>Secondly, how can I check before submission if the current input is in the valid date format (of the browser)?
I know that I could check with PHP after submit if the date format is given as YYYY-MM-DD, but how do you check it with JavaScript before submission?</p>