note 50879 deleted from function.date by cece

From: Date: Tue, 15 Nov 2005 14:55:14 +0000
Subject: note 50879 deleted from function.date by cece
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-98614@lists.php.net to get a copy of this message
Note Submitter: mgyth'at'online'dot'no ---- I made a simple, not accurate but working way of counting down in days to a target date. For simplicity it assumes a 365 day year and a 30 day month. <?php /*---Input Target day of month---*/ $day = '28' - date("d"); /*---Input Target month of year---*/ $month = '08' - date("m"); /*---Input Target year---*/ $year = '05' - date("y"); /*---And then we cheat a bit, it's only an approximate date---*/ if ($day <= '0'){ $month = $month - '1'; $day = $day + '30'; } /*---The math for the number of days are easy---*/ $total = ($year * '365') + ($month * '30') + $day; /*---And then we echo it for your viewing pleasure---*/ echo 'I\'ll be a dad in: '.$total.' days!'; ?>

« previous php.notes (#98614) next »