CAML中查询日期时包含时间
转 http://www.msotec.com/showtopic-2079.aspx
通常我们习惯性的查日期时使用
<Where>
<Eq>
<FieldRef Name='Created' />
<Value Type='DateTime'>2008-11-11 10:12:09</Value>
</Eq>
</Where>
但这种方法是没能按时间过滤,也就是说,用这个的方法去查找。会把2008-11-11,一天的数据都查出来。
正确的方法应该是
<Where>
<Eq>
<FieldRef Name='Created' />
<Value Type='DateTime' IncludeTimeValue='TRUE'>2008-11-11T10:12:09Z</Value>
</Eq>
</Where>
重点:1)IncludeTimeValue='TRUE'
2)时间格式 ISO8601 Date

浙公网安备 33010602011771号