0

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.

0

2 Answers 2

4

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>
1

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>

1
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.