<?php $t=time(); echo($t . "<br>"); echo(date("Y-m-d",$t)); ?>
check here link: http://www.eltcalendar.com/stuff/datemysqlphp.html