datetime 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: datetime php
$dateTime = new \DateTime();
$dateTime->format('Y-m-d H:i:s');
Example 3: date to string php
$date_string_prepared = date_create("2020-08-07");
$date_string = $date_string_prepared->format("d M Y");
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;