Re: calculo de meses (timestamp)
| From: | -// Era Binaria //- | Date: | Fri, 06 Feb 2004 08:11:42 +0000 |
| Subject: | Re: calculo de meses (timestamp) | ||
| References: | 1 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-45243@lists.php.net to get a copy of this message | ||
Prueba a poner la fecha en formato AÑO\MES\DIA.
Edu T.
www.vayafiestas.com
Tu Buscador de Fiestas.
----- Original Message -----
From: "Relys M." <relys@relys.net>
To: <lista@phpes.com>
Sent: Thursday, February 05, 2004 10:42 PM
Subject: Re: [PHP-ES] calculo de meses (timestamp)
> Hola:
>
> Estuve mirando tu el scripts y quizas este haciendo algo mal yo.
>
> si le paso las dos fechas de la sgte manera:
>
> $fecha_old="01/01/2003";
> $fecha_new="01/01/2004";
>
> print monthsApart ($fecha_old, $fecha_new);
>
> Me esta imprimiendo 0
>
> Sere yo el que esta haciendo algo mal??
> Salu2
> Relys
> >
> > Hola
> > hace algun tiempo encontre este script no recuerdo si en los comentarios
> > de php.net o en algun foro
> >
> > function monthsApart($oldDate,$newDate) {
> > list($oldYear,$oldMonth,$oldDay) = split("-",$oldDate);
> > list($newYear,$newMonth,$newDay) = split("-",$newDate);
> > $diff = (($newDay >= $oldDay ? 0 : -1) + ($newYear - $oldYear)* 12)
+
> > $newMonth - $oldMonth;
> > return abs($diff);
> > }
> >
> > que te hacia el calculo entre dos fechas y te regresaba el numero de
> > meses que habia entre ellas.
> >
> >
>
>
> ________________________________________________
> Message sent using webmail.relys.net
>
>
> ---------------------------------------------------------------------
> Archivo On-line: http://www.phpes.com/
> via news: news://news.phpes.com/
> Manual PHP en español: http://www.php.net/manual/es/
> Para dar de baja la suscripción, mande un mensaje a:
> lista-unsubscribe@phpes.com
>
>