note 50879 added to function.date

From: Date: Sat, 12 Mar 2005 20:15:36 +0000
Subject: note 50879 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-86333@lists.php.net to get a copy of this message
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!'; ?> ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+50879 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50879&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50879&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50879&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50879&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50879&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+50879&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#86333) next »