PHP date_format() Function Example Return a new DateTime object, and then format the date: <?php $date=date_create("2020-03-09"); echo date_format($date,"Y/m/d H:i:s"); ?>
$date = '25/05/2010'; $date = str_replace('/', '-', $date); echo date('Y-m-d', strtotime($date));