Advertisement
DraKiNs

[COD] Diferença de datas

Jul 14th, 2011
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.46 KB | None | 0 0
  1. /// #Exemplo
  2. //  echo "Se passaram " . diferencaDatas("02/03/2011", "02/05/2011") . " dias";
  3.  
  4.  
  5. function diferencaDatas($data1, $data2)
  6. {
  7.         $separar1 = explode('/', $data1);
  8.         $separar2 = explode('/', $data2);
  9.  
  10.         return round(((mktime(0, 0, 0, $separar2[1], $separar2[0], $separar2[2]) - mktime(0, 0, 0, $separar1[1], $separar1[0], $separar1[2])) / 86400));
  11. }
  12.  
  13.  
  14. // Espero que gostem, feito por Bruno da Silva
  15. // www.ips-team.blogspot.com
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement