Ver Mensaje Individual
  #3 (permalink)  
Antiguo 22/03/2005, 09:52
MALFAS
 
Fecha de Ingreso: septiembre-2003
Ubicación: VIña del Mar
Mensajes: 70
Antigüedad: 20 años, 6 meses
Puntos: 0
yo tengo esta funcion que es para restar fechas, te devolvera la diferencia entre las fechas.

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);           

__________________
www.cielonegro.cl
Comunidad chilena de entretencion

Última edición por MALFAS; 22/03/2005 a las 09:54