- print_r: documentation ( source)
- date_get_last_errors: documentation ( source)
- strftime: documentation ( source)
- date_format: documentation ( source)
- setlocale: documentation ( source)
<?php
setlocale (LC_ALL, 'pt_BR');
// Try to create the datetime instance
if ($date=DateTime::createFromFormat("d-M-y ",strftime("%d-%b-%y","09-mai-17"))){
echo date_format($date,"Y/m/d");
} else {
// It failed! Errors found, let's figure out what!
echo "<pre>";
print_r(date_get_last_errors());
echo "</pre>";
}