echo date("d-M-Y", strtotime("first monday 2019-07"));
Shouldn't the output of this line be 01-Jul-2019? Thats the first monday in July but the output is: 08-Jul-2019.
What is the error im making?
" first monday 2019-07 " returns the date of the first monday of july excluding the start date (in this case 1st july 2019). Where as "first monday of 2019-07" returns the date of the first monday of july including the start date.
Try
first monday of 2019-07
Instead of first monday 2019-07
.
Use,
echo date("d-M-Y", strtotime("first monday of 2019-07"));
You can find here php instructions to parsing date as natural languages.