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

posted @ 2008-11-27 17:39  浪漫稻草人  阅读(176)  评论(0)    收藏  举报