PHP code example of poliander / cron

1. Go to this page and download the library: Download poliander/cron library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

poliander / cron example snippets


use Poliander\Cron\CronExpression;

$expression = new CronExpression('15,45 */2 * * *');
$isValid = $expression->isValid(); // returns true

use Poliander\Cron\CronExpression;

$expression = new CronExpression('45 9 * * *');
$dt = new \DateTime('2014-05-18 09:45');
$isMatching = $expression->isMatching($dt); // returns true

use Poliander\Cron\CronExpression;

$expression = new CronExpression('45 9 * * *', new DateTimeZone('Europe/Berlin'));
$dt = new \DateTime('2014-05-18 08:45', new DateTimeZone('Europe/London'));
$isMatching = $expression->isMatching($dt); // returns true

use Poliander\Cron\CronExpression;

$expression = new CronExpression('* * 13 * fri');
$when = $expression->getNext();