Posted By

sendoa on 10/19/09


Tagged

fechas


Versions (?)

Número de días entre dos fechas


 / Published in: PHP
 

URL: http://blog.oridoki.com/2009/10/08/php-diferencia-entre-dos-fechas/

  1. function dateDifference($d1, $d2){
  2. $v1 = explode("-", $d1);
  3. $date1 = mktime(0, 0, 0, intval($v1[1]), intval($v1[0]), intval($v1[2]));
  4.  
  5. $v2 = explode("-", $d2);
  6. $date2 = mktime(0, 0, 0, intval($v2[1]), intval($v2[0]), intval($v2[2]));
  7.  
  8. $dateDiff = $date2 - $date1;
  9.  
  10. return floor($dateDiff/(60*60*24));
  11. }

Report this snippet  

You need to login to post a comment.