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"); ?>
$s = '06/10/2011 19:00:02'; $date = strtotime($s); echo date('d/M/Y H:i:s', $date);
<?php $date = new DateTime('2000-01-01'); echo $date->format('Y-m-d H:i:s'); ?>
$date_string_prepared = date_create("2020-08-07"); $date_string = $date_string_prepared->format("d M Y"); // result 07 Jul 2020
$today = date("F j, Y, g:i a"); // March 10, 2001, 5:16 pm