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

Have a ability to check every 1st saturday or every 2nd Monday of month #12

Closed mailaneel closed 12 years ago

mailaneel commented 12 years ago

Hi,

It would be nice to have this kind of functionality

Reference

Quartz does it like this.

mtdowling commented 12 years ago

Thanks for pointing out that utility. It will be handy for testing.

The functionality you are looking for is already implemented using an expression like this: 0 0 0 ? 1/1 MON#1 *

See https://github.com/mtdowling/cron-expression/blob/master/src/Cron/DayOfWeekField.php

mailaneel commented 12 years ago

Thank you for that, but i think you added extra 0 at the start..