note 102855 modified in function.cal-days-in-month by danbrown

From: Date: Thu, 10 Mar 2011 15:18:10 +0000
Subject: note 102855 modified in function.cal-days-in-month by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-177749@lists.php.net to get a copy of this message
Function for calculation number of days until birthday: <?php function daysLeftForBirthday($devabirthdate) { /* input birthday date format -> Y-m-d */ list($y, $m, $d) = explode('-',$devabirthdate); $nowdate = mktime(0, 0, 0, date("m"), date("d"), date("Y")); $nextbirthday = mktime(0,0,0,$m, $d, date("Y")); if ($nextbirthday<$nowdate) $nextbirthday=$nextbirthday+(60*60*24*365); $daycount=intval(($nextbirthday-$nowdate)/(60*60*24)); return $daycount; } ?> --was-- Function for calculation number of days until birthday: function daysLeftForBirthday($devabirthdate) { /* input birthday date format -> Y-m-d */ list($y, $m, $d) = explode('-',$devabirthdate); $nowdate = mktime(0, 0, 0, date("m"), date("d"), date("Y")); $nextbirthday = mktime(0,0,0,$m, $d, date("Y")); if ($nextbirthday<$nowdate) $nextbirthday=$nextbirthday+(60*60*24*365); $daycount=intval(($nextbirthday-$nowdate)/(60*60*24)); return $daycount; } http://php.net/manual/en/function.cal-days-in-month.php

« previous php.notes (#177749) next »