如果我有日期、月份和年份值,PHP 中有没有办法计算星期几?我不是指一周中的今天,而是过去未来的任何日期。
问问题
360 次
3 回答
1
$day_of_week = date ('l', strtotime ('2012-06-11 13:43:23'));
于 2013-03-02T16:25:16.260 回答
0
echo date('l',strtotime('3 March 2013'));
returns Sunday.
echo date('l',mktime(0,0,0,$month,$day,$year));
returns appropriately for integer values of month, day and year.
于 2013-03-02T16:23:54.063 回答
0
You can do it like this.
echo date('l j \of F Y', strtotime('2013-03-02'));
If you only want the day of the week change the first argument to just l.
PHP Date documentation has a very good list of what information you can "extract" from the date.
于 2013-03-02T16:26:15.843 回答