我想从数据库字段中取出日期 类型为date,然后取得当前日期,进行比较,如果当前日期大于数据库中的日期返回 真 否则返回假       自己从网上找了些,发现不行。。 求助

解决方案 »

  1.   

    if( (strtotime($data['date']) - time() ) > 0)
    return true;
    else
    return false;
      

  2.   

    楼上正解!!!!
    http://cn.php.net/manual/zh/function.strtotime.php
      

  3.   

    如果在php代码当中比较就用楼上的
    在mysql当中
    select  unix_timestamp(now())-unix_timestamp(字段)
    在mssql当中
    select case when datediff(second,字段,getdate())>0 then 'true' else 'false' end as flag
      

  4.   

    在mysql当中
    select  case when unix_timestamp(now())-unix_timestamp(字段)>0 then 'true' else 'false' end as flag