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.9k stars 335 forks source link

can't read cron expressions for 6 positions #175

Closed ruwanmadhusanka closed 4 years ago

ruwanmadhusanka commented 4 years ago

I want to convert cron values to human readable format.I have cron values that have 6 positions.these are the examples..

00 01 05 * * ?

$cron = Cron\CronExpression::factory('0 0 0 ? 1/2 FRI#2 *'); echo $cron->getNextRunDate()->format('Y-m-d H:i:s');

error>>> Invalid CRON field value 0 at position 2

how can I solve this.?

dragonmantank commented 4 years ago

Hello @roony4 !

This package is no longer being worked on, and has moved over to https://github.com/dragonmantank/cron-expression. If possible, please upgrade to the newest version of dragonmantank/cron-expression.

"Position 2" is actually the third slot (an error that is clearer in newer versions), and is the slot for "Day of Month." That number must be between 1 and 31. 0 is not a valid option.