PHP function that receive a cron string and return the next run timestamp

xun picture xun · Jan 3, 2011 · Viewed 12.1k times · Source

I need to develop a task system that should be able to work on servers that doesn't support crontab.

I'm asking if there is any existing code that can take a cron string (e.g. '0 0,12 1 */2 *' and return the timestamp of the next scheduled run.

If such a code couldn't be found then how should I start with that?

Answer

berebidahoo picture berebidahoo · Jan 3, 2011

You could use this class PHP-Parse-cron-strings-and-compute-schedules

It'll also compute the last scheduled run