Ver Mensaje Individual
  #4 (permalink)  
Antiguo 27/08/2008, 06:37
chuequex
 
Fecha de Ingreso: febrero-2008
Ubicación: Cajamarca-Peru
Mensajes: 68
Antigüedad: 16 años, 2 meses
Puntos: 0
Respuesta: Ayuda con resta de fechas

Ahi tienen el codigo pero no se que mas hacer.
Código PHP:
function resta_fechas($fecha1,$fecha2)
{
    if (
preg_match("/[0-9]{1,2}\/[0-9]{1,2}\/([0-9][0-9]){1,2}/",$fecha1))
    list(
$dia1,$mes1,$año1)=split("/",$fecha1);
    if (
preg_match("/[0-9]{1,2}-[0-9]{1,2}-([0-9][0-9]){1,2}/",$fecha1))
    list(
$dia1,$mes1,$año1)=split("-",$fecha1);
    if (
preg_match("/[0-9]{1,2}\/[0-9]{1,2}\/([0-9][0-9]){1,2}/",$fecha2))
    list(
$dia2,$mes2,$año2)=split("/",$fecha2);
    if (
preg_match("/[0-9]{1,2}-[0-9]{1,2}-([0-9][0-9]){1,2}/",$fecha2))
    list(
$dia2,$mes2,$año2)=split("/",$fecha2);
    
$dif mktime(0,0,0,$mes1,$dia1,$año1) - mktime(0,0,0,$mes2,$dia2,$año2);
    
$ndias=floor($dif/(24*60*60));
    return(
$ndias);