开发者

Query Datetime field in SPList

Can u tell me how to compare the date as well as time stored in a SPList as a DateTime fiel开发者_StackOverflow社区d with the current system time using a CAML query?


To compare with todays date:

<Where>
  <Lt>
    <FieldRef Name='Created'/>
    <Value type='DateTime'><Today /></Value>
  </Lt>
</Where>

To compare todays date AND time

<Where>
  <Lt>
    <FieldRef Name='Created'/>
    <Value type='DateTime' IncludeDateTime='TRUE'><Today /></Value>
  </Lt>
</Where>

To compare yesterdays date

<Where>
  <Lt>
    <FieldRef Name='Created'/>
    <Value type='DateTime'><Today Offset='-1' /></Value>
  </Lt>
</Where>


To compare yesterday's date should be "OffsetDays"

<Where>
  <Lt>
    <FieldRef Name='Created'/>
    <Value type='DateTime'><Today OffsetDays='-1' /></Value>
  </Lt>
</Where>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜