我在生日前的最后一天搜索计算函数。
问问题
91 次
2 回答
1
$timestamp = strtotime("yesterday", $birthday);
$birthday 必须是时间戳,如果 $birthday 是像“1992-09-98”这样的字符串,你必须像这样改变它
$birthday = strtotime($birthday);
于 2012-10-31T15:58:55.343 回答
0
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;
}
于 2012-10-31T16:31:30.557 回答