例如今天是 2020.06.26(五),是本年的第 26 週
想知道去年第 26 週的星期五是哪天
$dToday = time(); $sToday = date('Y.m.d', $dToday); $iWeek = (int) date('W', $dToday); // 今日是本年的第幾週 $iWeekday = (int) date('w', $dToday); // 今日是星期幾 $dLastyear1 = strtotime("1 January ".(date('Y',$dToday)-1)); // 去年第一天 $dLastyearday = strtotime("+".($iWeek-1)*7+($iWeekday-2)." day", $dLastyear1); // 去年同週的日期 echo 'Lastyear first day == '.date('Y.m.d(w, D, 第W週)',$dLastyearday);
沒有留言:
張貼留言