根据今年的周数,我无法弄清楚从星期一获取日期的代码。
有人可以帮我处理这段代码吗?
谢谢。
这将提供今年某一周的星期一:
$thisYear = date('Y');
$weekNum = 40;
$date = date('Y-m-d', strtotime("$thisYear-W$weekNum-1")); // Outputs 2013-09-30
我有这个(我不确定我或其他人是否是原作者)但试一试:
$week = 34; //Enter your week here.
$week = mktime( 0, 0, 0, 1, 1, 2013 ) + ( $week * 7 * 24 * 60 * 60 );
$monday = $week - 86400 * ( date( 'N', $week ) - 1 );
$monday = date( 'Y-m-d', $monday );
echo $monday;