I have an issue with the php date function when getting the week it is incrementing it by 1.
For example:
2020-11-31 is becoming week 49 instead of week 48.
Code as follows:
date("W",strtotime("2020-11-30"));
I have an issue with the php date function when getting the week it is incrementing it by 1.
For example:
2020-11-31 is becoming week 49 instead of week 48.
Code as follows:
date("W",strtotime("2020-11-30"));
First of all November has 30 days, not 31. 2nd, if you pass the correct date 2020-11-30 then this IS 49th week indeed. Week Number:49/2020 Start Date: Nov 29, 2020 End Date: Dec 5, 2020
You can also do this:
$ddate = "2020-11-30";
$date = new DateTime($ddate);
$week = $date->format("W");
echo "Week Number: $week";