将给定日期中的月份名称转换为月份编号


Converting month name in given date into month number

可能重复:
转换的PHP日期格式

我有一个像2012年9月-09这样的约会。如何使用PHP将其转换为2012-09-09

您可以尝试使用strptime

$date = '2012-september-09';
$strp = strptime($date, '%Y-%B-%d');
$ymd = sprintf('%04d-%02d-%02d', $strp['tm_year'] + 1900, $strp['tm_mon'] + 1, $strp['tm_mday']);
$new_date = new DateTime($ymd);
echo $new_date->format('Y-m-d');

这是一个Codepad

试试这个

Change 
<?php echo date('Y-m-d',strtotime('2012-september-09'));?>
 To
<?php echo date('Y-m-d',strtotime('09-september-2012'));?>