3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $lastDate = '1452609936'; $interval = 'P0Y0M1D'; //create objects from strings $interval = new \DateInterval($interval); echo 'Interval: '.$interval->format('%y years, %m months, %d days')."\n"; //last sent $lastJob = new \Datetime(); $lastJob->setTimestamp($lastDate); //las sent + interval $nextJob = new \Datetime(); $nextJob->setTimestamp($lastDate); $nextJob->add($interval); //now $currentJob = new \Datetime(); echo 'Last Sent: '.$lastJob->format('Y/m/d'). ' | Next Job: '.$nextJob->format('Y/m/d'). ' | Today: '.$currentJob->format('Y/m/d')."\n"; if ($nextJob > $currentJob) { echo 'not ready to send.'; } else { echo 'ready to send'; }
based on 4F8r3
Output for 5.3.21 - 7.3.0
Interval: 0 years, 0 months, 1 days Last Sent: 2016/01/12 | Next Job: 2016/01/13 | Today: 2016/01/13 ready to send