I really like the strtotime()
function, but the user manual doesn\'t give a complete description of the supported date formats. strtotime(\'dd/mm/YYYY\')<
Here is the simplified solution:
$date = '25/05/2010';
$date = str_replace('/', '-', $date);
echo date('Y-m-d', strtotime($date));
Result:
2010-05-25
The strtotime documentation reads:
Dates in the m/d/y or d-m-y formats are disambiguated by looking at the separator between the various components: if the separator is a slash (/), then the American m/d/y is assumed; whereas if the separator is a dash (-) or a dot (.), then the European d-m-y format is assumed.