PHP code example of g4 / cron

1. Go to this page and download the library: Download g4/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/ */

    

g4 / cron example snippets




$expression = \G4\Cron\CronExpression::factory('*/3 * * * * * *');

echo date('Y-m-d H:i:s'), ' = ', $expression->getNextRunDate()->format('Y-m-d H:i:s'), PHP_EOL;
echo date('Y-m-d H:i:s'), ' = ', $expression->getPreviousRunDate()->format('Y-m-d H:i:s'), PHP_EOL;