Gor*_*don 48
使用DateTime API(需要PHP 5.3+):
$dateTime = DateTime::createFromFormat('F d, Y', 'Apr 30, 2010');
echo $dateTime->format('Y-m-d');
Run Code Online (Sandbox Code Playgroud)
或者在程序风格上相同(需要PHP 5.3+):
$dateTime = date_create_from_format('F d, Y', 'Apr 30, 2010');
echo date_format($dateTime, 'Y-m-d');
Run Code Online (Sandbox Code Playgroud)
或经典(需要PHP4 +):
$dateTime = strtotime('Apr 30, 2010');
echo date('Y-m-d', $dateTime);
Run Code Online (Sandbox Code Playgroud)
zaf*_*zaf 13
尝试http://php.net/manual/en/function.strtotime.php转换为时间戳,然后http://www.php.net/manual/en/function.date.php将其转换为您自己的时间戳格式.