pasar datetime a string php code example
Example 1: pasar datetime a string php
$theDate = new DateTime('2020-03-08');
echo $stringDate = $theDate->format('Y-m-d H:i:s');
Example 2: pasar datetime a string php
$dateFormat = new DateTime();
echo $stringDate = $date->format(DATE_ATOM);
Example 3: pasar datetime a string php
$date = date_create_from_format('d M, Y', '08 Mar, 2020');
echo $newFormat = date_format($date,"Y/m/d H:i:s");
Example 4: pasar datetime a string php
$date = explode("/",date('d/m/Y/h/i/s')
list($day,$month,$year,$hour,$min,$sec) = $date);
echo $month.'/'.$day.'/'.$year.' '.$hour.':'.$min.':'.$sec;