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>
精彩评论