I want to retrive 8 rows from list which is greater than current time (not date) using caml query. Please help me out on this.
2 Answers
You can use <Today />
tag to get current date , additionally if you add IncludeTimeValue='TRUE'
, it will get you current time.
Try this:
<Where>
<Gt>
<FieldRef Name='YourColumnName' />
<Value IncludeTimeValue='TRUE' Type='DateTime'><Today /></Value>
</Gt>
</Where>
Below is a CAML query which includes time while doing comparisons. Check if this helps.
<Where>
<And>
<Gt>
<FieldRef Name='Modified' />
<Value IncludeTimeValue='TRUE' Type='DateTime'>2011-02-09T12:00:00Z</Value>
</Gt>
<Lt>
<FieldRef Name='Modified' />
<Value IncludeTimeValue='TRUE' Type='DateTime'>2011-02-10T10:00:00Z</Value>
</Lt>
</And>
-
Thanks for your response. Unnie Your query checks date as well as.But i need to compare only timings. Is that possible. I dont want to check date. Commented Jan 28, 2015 at 5:23