mysql: select ... where to_days(`datefield`) >= to_days(now()) - 1
php: strtotime("-1 day");

解决方案 »

  1.   

    差了一点。
    php: echo date("Y-m-d", strtotime("-1 day"));
      

  2.   

    .... where to_day(date)=to_day('2005-03-18')-1
      

  3.   

    mysql: select ... where to_days(`datefield`) = to_days(now()) - 1
    php: echo date("Y-m-d", strtotime("-1 day"));哈哈!!发两次都有问题,真是不好意思哦。
    这样子才是最后的答案。
      

  4.   

    .... where to_day(date)=to_day('2005-03-18')-1
      

  5.   

    先使用mktime(0,0,0,3,18,2005)得到UNXI时间戳记后再减去86400(一天)再作用date("Y-m-d",得到的值)函数得到日期字符串这是完整语句:
    $xx=explode("-","2005-03-18");
    $thisday=date("Y-m-d",mktime(0,0,0,$xx[1],$xx[2],$xx[0]));
      

  6.   

    呵呵,看来我的方法复杂了,,,用 today更好。。