Example:
$startDate
is Monday 2007-02-05 and $endDate
is Tuesday 2007-02-20. Then I want it to list:
Monday 2007-02-05
Monday 2007-02-12
Monday 2007-02-19
I looked at the PHP manual and found this to get all the days between two dates. But how to do it the way i want? PHP Code:
I had similar issue and courses can start on any day. This script picks starting day and collect next days every week until the wanted amount (12 in this case).
This is code for fetching the weekday of "$startdate" and counting the number of weekdays between two dates.
You can use below function to get a array of dates between a date range of specific day.
You have to input start date, end date and day number in number.The day number is as follow. 1 = Monday, 2 = Tuesday, 3 = Wednesday, 4 = Thursday. 5 = Friday, 6 = Saturday, 7 = Sunday.
i Create A class, You get All Days In range Date Group By Name of Day:
The Output will be like this
Convert $startDate and $endDate before that to timestamps: