mtdowling / cron-expression

CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due
http://mtdowling.com/blog/2012/06/03/cron-expressions-in-php/
MIT License
4.89k stars 339 forks source link

day of week #9

Closed peerrabe closed 13 years ago

peerrabe commented 13 years ago

hello,

day of wek usage of 1/2 does not work. It should be used every 2 weeks but it raises an InvalidArgumentException.... is the use of 1/2 for day of week not recommended? greets p

mtdowling commented 13 years ago

I don't think it's possible to get cron to run something every 2 weeks. You could try the following:

  1. Schedule it for every 14 days
  2. Create an @weekly schedule and test in the file the last time the action was run. If it hasn't been two weeks, then exit.