1 2 3 4 |
$old_date = date('y-m-d-h-i-s'); $new_date = date('Y-m-d H:i:s', strtotime($old_date)); |
Change how it looks
1 2 3 4 5 |
$timewanted = '14:00:30'; OUTPUT 14:00 echo $new_date = date('H:i', strtotime($timewanted)); |
and convert date format
1 2 3 4 |
$dob = "1940-01-02"; echo $dob = date("d-m-Y", strtotime($dob)); |
OUTPUT 02-01-1940