Guest User

Untitled

a guest
Jul 9th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. <?php
  2.  
  3. function since($year, $month, $day, $hour, $minute)
  4. {
  5. $born = mktime($hour, $minute, 0, $month, $day, $year, -1);
  6.  
  7. $today = time();
  8.  
  9. $diff = $today - $born;
  10. if ($diff < 0) $diff = 0;
  11.  
  12. $days_since = floor($diff/60/60/24);
  13. $hours_since = floor(($diff - $days_since*60*60*24)/60/60);
  14. $minutes_since = floor(($diff - $days_since*60*60*24 - $hours_since*60*60)/60);
  15.  
  16. echo "".$days_since. " days " .$hours_since. " hours " .$minutes_since. " minutes";
  17.  
  18. }
  19.  
  20. echo since($year, $month, $day, $hour, $minute);
  21.  
  22. ?>
Add Comment
Please, Sign In to add comment