php 日期时间运算比较

    $sql= "select * from t_datestudy where id='4750' and agreemode='2' and school_agree !='1'";       
    $result = mysql_query($sql,$connection);
    $app = mysql_fetch_array($result);
    mysql_free_result($result);
    $dt1 = $app['CDATE'] . ' ' . $app['START_TIME'] ;
    $dt2 = date('Y-m-d H:i:s',strtotime('+2 Hour'));
    if ($dt2 > $dt1)
        echo "exceed";
    else
        echo "ok";

posted on 2016-05-31 10:11  xihong  阅读(216)  评论(0编辑  收藏  举报

导航