Número de días entre dos fechas


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  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. }

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.