我的代码
$time = "Tuesday, 26 June 2012";
//str_replace(',','',$time);<--this also doesn't work.
$a = strptime($time, "%l, %j %F %Y");
$stmp = mktime(0,0,0,$a['tm_mon'],$a['tm_mday'],$a['tm_year'],0);
$from_stmp = date("l, j F Y H:i:s", $stmp);
echo $from_stmp; //Tuesday, 30 November 1999 00:00:00
现在我知道有一种更优雅的方式,它确实有效:
$time = "Tuesday, 26 June 2012";
$stmp = strtotime($time);
$from_stmp = date("l, j F Y H:i:s", $stmp);
echo $from_stmp;//Tuesday, 26 June 2012 00:00:00
但是第一个版本有什么问题?我只是好奇。