0
我需要1969年獲得實際的週數起這樣開始:PHP:獲取週數由1969年
$dateTime = new DateTime;
$now = '2017-01-01';
//
// $week = date('W', strtotime($now . ' +2 days'));
// I will get the week number between 01-53 and this is not what I want.
// I need to set the starting year and get the week number since 1969 to get the expected results.
// How to get the value 2506 from this $week variable?
//
$dateTime->setISODate('1969', 2506, -1);
$start_by = $dateTime->format('Y-m-d');
// output: 2016-12-31
正如你所看到的,「2016年12月31日」是日期時間我的一週開始。
預先感謝您!
什麼是**實際的週數**?這是今年的週數嗎?這是自1969年以來已經過去的幾周嗎?這是作業嗎? – Peon
這是自1969年以來的週數 –
獲得當前週數,並將其乘以所有前幾年的週數。像本週是23,然後23 +(從1969年* 53年)=一些價值 –