Advertisement
Guest User

Untitled

a guest
Jul 30th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. function daysTo($from, $to, $round=true)
  2. {
  3. $diff = $to-$from;
  4. $days = ($diff/86400)+1;
  5. return $round==true ? floor($days) : round($days,2);
  6. }
  7. //usage
  8. $from = strtotime($start_date); // tarikh mula
  9. $to = strtotime($end_date); //tarikh akhir
  10. echo daysTo($from, $to, false);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement