<?php
$year = '2017';
$week = '2';
echo date( "F jS", strtotime($year."W".$week."0"));
?>
我没有得到我预期的结果;我想要Sun 8th
,但我得到了May 15th
。
我做错了什么?
试试这个,
$year = "2017";
$week = "02"; // Week number must be two digit
$date1 = date( "l, M jS, Y", strtotime($year."W".$week."0") ); // First day of week
echo $date1;
输出
Sunday, Jan 8th, 2017
https://3v4l.org/HbKPU
我希望这会有所帮助。
我想
你想第二周的第一天对吗?那天是第8天:
echo date( "D jS", mktime(0, 0, 0, 1, 8, 2017));