有一种简单的方法可以从非常简单的日期字符串中获取日期吗?
例如:
14 mar 2012
转换为:
Wed, 14 mar 2012
答案 0 :(得分:3)
您应该熟悉DateTime
:
$str = "14 mar 2012";
$date = DateTime::createFromFormat("j M Y", $str);
$str = $date->format("D, j M Y");
答案 1 :(得分:2)
$dateUnformated = '14 mar 2012';
$dateFormated = date("D, j M Y", strtotime($dateUnformated));