[wd_asp elements=’search’ ratio=’100%’ id=1]

Get PHP week numbers from start date to end dates

12th September 2018

Php - Dates & Time

php codehaven

Result is
33
34
35
36
37


$start_date="2018-08-19 00:00:00";
$end_date="2018-09-19 00:00:00";

for($w = strtotime($start_date); $w <= strtotime($end_date); $w += 7 * 24 * 3600) { echo date("W", $w) . '
';
}