8
給出一個時間戳我需要找到第一天時間戳屬於周。
例如
$format = "first day of week";
//convert to time
$time = strtotime("2011-07-01 00:00:00");
//format the time to the first day of the week
$date = strtotime($format,$time);
//Put the first day of the week into a pretty format
$weekStartDate = date("Y-m-d",$date);
本週開始應該在此刻它走了可怕的錯誤等於2011-06-27和1970-01-01等於這表明我的「一週的第一天」的格式是無效的。
任何想法,將不勝感激,謝謝,
你var_dumped您的strtotime輸出看你得到了什麼? – 2011-07-01 08:56:45
謝謝佩卡,它的重複答案是在另一個問題上,並使用格式「上週日」 – woot586
$格式=「第一天的一週」;應該是「本週的第一天」,不是嗎? – sdolgy