Mailinglisten-Archive |
Sebastian Mendel wrote:
> $days = 0;
> $month = 0;
> $years = 0;
>
> $start = strtotime('2004-05-12');
> $end = strtotime('2005-06-12');
>
> $days = date('d', $end) - date('d', $start);
> if ( $days < 0 )
> {
> $month--;
> $days = date('t', $start) - date('d', $start);
> $days += date('d', $end);
> }
>
> $month += date('n', $end) - date('n', $start);
> if ( $month < 0 )
> {
> $years--;
> $month = 11;
$month -= 12; // naja, kleiner tipp-fehler! ;-)
> }
>
> $years += date('y', $end) - date('y', $start);
>
> echo $years . ' Jahr(e) ' . $month . ' Monat(e) und ' . $days . ' Tag(e).';
--
Sebastian Mendel (www.sebastianmendel.de)
*www.warzonez.de* | www.tekkno4u.de | www.nofetish.com
php::bar PHP Wiki - Listenarchive