fork download
  1. <?php
  2.  
  3. $future_unix_time = "1542807180";
  4.  
  5. $now = new DateTime();
  6. $now->add(new DateInterval('PT3H'));
  7. $check_time = DateTime::createFromFormat('U', $future_unix_time);
  8. // echo $now->format('M-d-Y H:i:s');
  9. if($now->format('U') <= $check_time)
  10. $state = "less";
  11. else
  12. $state = "greater";
  13.  
  14. echo sprintf("%s is %s than %s", $now->format('Y-m-d H:i:s'), $state, $check_time->format('Y-m-d H:i:s'));
Success #stdin #stdout 0s 82624KB
stdin
Standard input is empty
stdout
2018-10-25 17:03:49 is less than 2018-11-21 13:33:00