Guest User

Untitled

a guest
Apr 22nd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.35 KB | None | 0 0
  1.     $today = new DateTime();
  2.     $alert_date = new DateTime($alerts[$i]['due']);
  3.  
  4.     $interval = $today->diff($alert_date);
  5.  
  6.     if($interval->d > 0) {
  7.         $deadline = $interval->format('%d') . ' days';
  8.     } elseif($interval->m > 0) {
  9.         $deadline = $interval->format('%m') . ' months';
  10.     } elseif($interval->y > 0) {
  11.         $years = $interval->format('%y') . ' years';
  12.     }
Add Comment
Please, Sign In to add comment