Home  >  Article  >  Backend Development  >  PHP ADO ACCESS数据库,SQL怎么比较时间大小?

PHP ADO ACCESS数据库,SQL怎么比较时间大小?

WBOY
WBOYOriginal
2016-06-23 14:01:581021browse

现在用PHP + ADO + ACCESS数据库,比较时间遇到问题

ACCESS数据库的Time字段存储的为 COleDateTime格式的时间数据。
下面二行代码为MFC 编程时写入数据库的“Time”字段的代码
COleDateTime ct=COleDateTime::GetCurrentTime();
m_pRecordset_record->PutCollect("Time",_variant_t(ct));
-------------------------------------------------------
下面是我想达到的日期筛选SQL,但实际上sqlstr这样写是有问题的,php执行错误的,想请教一下怎样写才是正确的。
$sqlstr="select * from record where NameStr='$sensor' and Time>'2014/01/15'";
$rsRecord1->Open($sqlstr,$conn1,1,1);


回复讨论(解决方案)

$sqlstr="select * from record where NameStr='$sensor' and Time> #2014-01-15#";

$sqlstr="select * from record where NameStr='$sensor' and Time> #2014-01-15#";
谢谢版主,这样确实可用,结帖

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn