PHP convert date to DD-M-YY : <p>I'm trying to validate a date like 17-JAN-1985 in my code.</p>

<p>Here is the function I'm using:</p>

<pre><code>function fncDate($date){
    $d = DateTime::createFromFormat('DD-M-YY', $date);
    $result = $d &amp;&amp; $d-&gt;format('DD-M-YY') == $date;
    if(!$result){
        return "Date should be in the following format: DD-MMM-YYYY"; 
    }
}
</code></pre>

<p>This returns always false: <code>fncDate("17-JAN-1985");</code></p>

<p>Am I doing something wrong?</p>

<p>Thanks</p>
