$date = date_create_from_format('d-m-Y', '22-03-2018'); // Output date in given format $a = date_format($date, 'Y-m-d'); echo $a; echo strtotime($a);