Here is a cron
expression that I tried: 0 0 0 */14 * ?
. It creates the following schedule:
Start Time:
Friday, September 8, 2017 1:25 AM
Next Times:
- Friday, September 15, 2017, 12:00 AM
- Friday, September 29, 2017, 12:00 AM
- Sunday, October 1, 2017, 12:00 AM
- Sunday, October 15, 2017, 12:00 AM
- Sunday, October 29, 2017, 12:00 AM
This expression is working for every 2 weeks in every month, but my requirement is it has to run for every 2 weeks. I mean after executing September 29th, the next date should be October 13, but it schedules for October 1.
die
orexit
. – Erythritepublic function date_differnece($d1, $d2) { $date1 = new DateTime($d1); $date2 = new DateTime($d2); return $date2->diff($date1)->format("%r%a"); }
– Erythrite