<?php
/**
* Get date of next crontab's run
*/
$cron_format = explode(" ", "00 00 00 01 * *"); // <second> <minute> <hour> <day> <month> <week_day> $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 $format = [];
foreach( $date_diff as $key=>$value)
{
$format[$value] = $cron_format[$key] !== "*" ?
date($value, strtotime($cron_format[$key])) : date($value); }
$spf = sprintf("%s-%s-%s %s:%s:%s", date("Y"), $format["m"], $format["d"], $format["H"], $format["i"], $format["s"]);
$date = DateTime::createFromFormat("Y-m-d H:i:s", $spf);
echo $date->format("Y-m-d H:i:s");
PD9waHAKCi8qKgogKiBHZXQgZGF0ZSBvZiBuZXh0IGNyb250YWIncyBydW4KICovIAoKJGNyb25fZm9ybWF0ID0gZXhwbG9kZSgiICIsICIwMCAwMCAwMCAwMSAqICoiKTsgLy8gPHNlY29uZD4gPG1pbnV0ZT4gPGhvdXI+IDxkYXk+IDxtb250aD4gPHdlZWtfZGF5PgokZGF0ZV9kaWZmICAgPSBleHBsb2RlKCIgIiwgInMgaSBIIGQgbSB3Iik7ICAgICAvLyBwaHAgRGF0ZSBAbGluayBodHRwOi8vcC4uLmNvbnRlbnQtYXZhaWxhYmxlLXRvLWF1dGhvci1vbmx5Li4ucC5uZXQvbWFudWFsL2VuL2Z1bmN0aW9uLmRhdGUucGhwCiRmb3JtYXQgPSBbXTsKCmZvcmVhY2goICRkYXRlX2RpZmYgYXMgJGtleT0+JHZhbHVlKQp7CiAgICRmb3JtYXRbJHZhbHVlXSA9ICRjcm9uX2Zvcm1hdFska2V5XSAhPT0gIioiID8gZGF0ZSgkdmFsdWUsIHN0cnRvdGltZSgkY3Jvbl9mb3JtYXRbJGtleV0pKSA6IGRhdGUoJHZhbHVlKTsKfQoKJHNwZiA9IHNwcmludGYoIiVzLSVzLSVzICVzOiVzOiVzIiwgZGF0ZSgiWSIpLCAkZm9ybWF0WyJtIl0sICRmb3JtYXRbImQiXSwgJGZvcm1hdFsiSCJdLCAkZm9ybWF0WyJpIl0sICRmb3JtYXRbInMiXSk7CgokZGF0ZSA9IERhdGVUaW1lOjpjcmVhdGVGcm9tRm9ybWF0KCJZLW0tZCBIOmk6cyIsICRzcGYpOwoKZWNobyAkZGF0ZS0+Zm9ybWF0KCJZLW0tZCBIOmk6cyIpOw==