我要实现18:00前显示昨天数据18:00后显示今天数据,帮我看看这个语句有什么问题!! where newstime>=concat(date_format(date_add(now(),interval -1 day),'%Y-%m-%d'),' 18:00:00') 这个只实现了18:00前显示昨天数据,但是18:00后发的今天数据等到24:00才会显示该怎么写才显示18:00后是今天的数据

解决方案 »

  1.   

    $yest=date('Y-m-d' , strtotime('-1 day'))." 18:00:00"; 
    select 语句where newstime>='$yest'
      

  2.   


    $showtime=date("H:i:s");
    if($showtime<'18:00:00')
    {
    $Datetime=date('Y-m-d' , strtotime('-1 day')); 
    }
    ELSE
    {
    $Datetime=date('Y-m-d'); 
    }
    //echo $Datetime;
    $query="select * from table where fd_time like '$Datetime%'";
      

  3.   

    sql语句 在数据库是错的啊
      

  4.   

    if(date('H:i:s',time())<"18:00:00"){
    $times=date('Y-m-d');
    }
    if(date('H:i:s',time())>"18:00:00"){
    $times=date('Y-m-d' , strtotime('-1 day'));
    }
    $sql = "select * from table where fd_time like '%$times%'";