 <p>or you can use</p> <pre><code>$dob1=trim($_POST['txt_dob']);//$dob1='dd/mm/yyyy' format list($d, $m, $y) = explode('/', $dob1); $mk=mktime(0, 0, 0, $m, $d, $y); $dob_disp1=strftime('%Y-%m-%d',$mk); </code></pre>