在 PHP 中以工作日、日月、年格式格式化日期


Formatting the date in weekday, day month, year format in PHP?

如何以工作日、日月、年等格式格式化日期,例如 2013 年 10 月 18 日星期五?我尝试使用 strotime() 和使用 date() 函数进行回显,但由于工作日未正确返回,因此无法实现此格式。

这可以按以下方式完成:-

<?php
     echo date('l ', jS  F Y ');
?>

您可以在此处了解有关日期和时间格式的更多信息。

这工作正常:

// Use string to time to get the date as a unix timestamp
$myTime = strtotime("Friday, 18th  October 2013");
// Use that timestamp to reform it into a date, in which ever format you want orrding to the date() documentation.
$newTime = date('l, jS F Y', $myTime);
// Show the date in the format
echo $newTime;

在这里看到它的工作:http://www.tehplayground.com/#i9U7grxCr