$d = new datetime(date('H:i:s', strtotime('2014-09-30 23:21:55')));
$t = $d->diff(new datetime('18:00:0'));
echo $t->format('%H:%I:%S  ');
echo $t->h * 60 + $t->i + $t->s / 60;05:21:55  321.91666666667

解决方案 »

  1.   

    $seconds= (strtotime("2014-09-30 23:21:55")-strtotime("18:00")+86400)%86400;$minutes = floor($seconds/60);var_dump($minutes);
      

  2.   

    参考函数:strtotime或者百度'计算时间差'
      

  3.   

    假如:
    kq.kq_time的值为2014-09-30 23:21:55
    kq_c.am_on的值为18:00怎样使下面的MYSQL语句成立?
    $sql_where .=" and DATE_FORMAT(kq.kq_time,'%H:%i')>kq_c.am_on";