if(date('Y-m-d',time()-3*24*60*60) == 数据库中的生日字段)
{}

解决方案 »

  1.   

    如果你是想具体计算出两个日期之间间隔的天数的话,下面的代码就可以实现:
    $birth_year=date("Y",strtotime($myrow["birthdate"])); 
    $birthdate=date("m-d",strtotime($myrow["birthdate"])); 
    $d1=strtotime($birth_year."-".$birthdate); //recorded
    $d2=strtotime(date("Y-m-d"));  //now
    $diff=$d1-$d2;   //seconds
    $diff=$diff/3600/24;   //day在$diff=0的情况下,就表示今天是你的生日,我的中国....
      

  2.   

    $birthday = "1976-12-1"; //生日$birthday = preg_replace('/\d+/', date('Y'), $birthday, 1); //调整到今年$d = 60*60*24; //一天的秒数
    $n = floor((strtotime($birthday) - time())/$d); //生日与今天的差距
    if($n <= 3 && $n > 0) {
      echo "还有 $n 天就是你的生日";
    }
      

  3.   

    参考~
    生日提前五分钟提醒
    select * from 生日表 where datediff('minute',f开始时间,getdate())>5