string ke datetime php
$s = '06/10/2011 19:00:02';
$date = strtotime($s);
echo date('d/M/Y H:i:s', $date);
TC5550
$s = '06/10/2011 19:00:02';
$date = strtotime($s);
echo date('d/M/Y H:i:s', $date);
<?php
// To change the format of an existing date
$old_date_format = "20/03/1999";
$new_data_format = date("Y-m-d H:i:s", strtotime($old_date_format));
$date = DateTime::createFromFormat('d-m-Y', '15-12-2020');
<?php
$date = DateTime::createFromFormat('j-M-Y', '15-Feb-2009');
echo $date->format('Y-m-d');
?>
<?php
$date = '05/05/2021';
echo DateTime::createFromFormat("d/m/Y", $date)->format('Y-m-d');
//2021-05-05
<?php
$date = DateTime::createFromFormat('j-M-Y', '15-Feb-2009');
echo $date->format('Y-m-d');
?>