HEX
Server: Apache
System: Linux ecngx285.inmotionhosting.com 4.18.0-553.79.1.lve.el8.x86_64 #1 SMP Wed Oct 15 17:59:35 UTC 2025 x86_64
User: zeusxp5 (3862)
PHP: 8.3.28
Disabled: NONE
Upload Files
File: /home/zeusxp5/lrliberia.com/wp-content/plugins/boldgrid-backup/vendor/boldgrid/tdcron/README.md
> **WARNING**: This class was written back in 2010 ! Its pretty much untested with all PHP versions > 5.6.0 and might act funny. I mostly pushed it to GitHub for easier access and in case if somebody is looking for a simple cron-parser.

# tdCron

tdCron is a ***very*** simple class to parse cron-expressions and calculate schedules. 

For something more sophisticated (and WAY more modern) you can take a look at the [cron-expression](https://github.com/dragonmantank/cron-expression) package by Michael Dowling and Chris Tankersley.

## Getting Started

### Installation

Just include `class.tdcron.php` and `class.tdcron.entry.php` in your project and you're done.

## Documentation

As i mentioned before - this class is really, really simple :-) 

Please just look at the code in `test.php` and `class.tdcron.php` - its reasonably well documented and should be pretty easy to understand. 

It basically comes down to calling `tdCron::getNextOccurrence()` or `tdCron::getLastOccurrence()` with your cron-expression as the first parameter and an optional reference-time as the second parameter.

Lets say you've got a cron-expression like `5 0 * 8 2` (so something at 00:05 on every tuesday in august). You could use something like

    echo 'next: '.date('d.m.Y, H:i:s', tdCron::getNextOccurrence('5 0 * 8 2');

to see when it should run the next time.

## Running the tests

There aren't any "real" tests included with the class (so you won't find any PHPUnit-stuff here). You can find a bunch of edge-cases in the test.php / test.data.php files that were used to test the class during development.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE.md) file for details