Access中存储的时间跟当前时间比较,
数据库中时间格式:2005-7-5 15:23:35

解决方案 »

  1.   

    select * from table1 where dateField < now()普通比较,就是这样,如果要计算天,月,年,甚至小时,分钟的,差额。就要用到datediff(,,,)
      

  2.   

    类似这样:
    select * from EventLog where theTime>=#2009-12-17 11:20:35# and ...(其中theTime为数据库中的时间)
      

  3.   

    如果是datetime类型的那么你用
    CString strsql;
    CString strcurtime; // 格式应该是 2009-12-17 11:23:30
    strsql.Format("select * from 表名 where where 列名 < ('%s.999')",strcurtime);
      

  4.   

    SELECT * FROM 表名 WHERE  列名 < now() //或者在程序中先获取当前时间,传入SQL语句CString str;
    COleDateTime tm;
    tm = COleDateTime::GetCurrentTime();
    str = tm.Format("%Y-%m-%d %H:%M:%S");
    str.Format("SELECT * FROM 表名 WHERE  列名 < '%s'", str);
      

  5.   

    我就是不想再获取时间,想直接通过sql来比较
    比如:SELECT * FROM 表名 WHERE  列名 < now() 
    不知道now()得到的时间是什么格式的,有没有精确到秒
      

  6.   

    应该可以直接比较的啊,now是datatime类型,默认是精确到秒的