fork(2) download
  1. <?php
  2.  
  3. /**
  4.  * Get date of next crontab's run
  5.  */
  6.  
  7. $cron_format = explode(" ", "00 00 00 01 * *"); // <second> <minute> <hour> <day> <month> <week_day>
  8. $date_diff = explode(" ", "s i H d m w"); // php Date @link http://p...content-available-to-author-only...p.net/manual/en/function.date.php
  9. $format = [];
  10.  
  11. foreach( $date_diff as $key=>$value)
  12. {
  13. $format[$value] = $cron_format[$key] !== "*" ? date($value, strtotime($cron_format[$key])) : date($value);
  14. }
  15.  
  16. $spf = sprintf("%s-%s-%s %s:%s:%s", date("Y"), $format["m"], $format["d"], $format["H"], $format["i"], $format["s"]);
  17.  
  18. $date = DateTime::createFromFormat("Y-m-d H:i:s", $spf);
  19.  
  20. echo $date->format("Y-m-d H:i:s");
Success #stdin #stdout 0.02s 24080KB
stdin
Standard input is empty
stdout
2018-03-01 00:00:00