I have a list "List-A" which have an item with following details:

StartDate: 2021-08-31T22:00:00Z [In list view- 09/1/2021, type- DateOnly]

EndDate: 2021-09-29T22:00:00Z [In list view- 09/30/2021, Type- DateOnly]

From console application I am passing following caml query to pick the items (sharing Where clause only) :

          <FieldRef Name='StartDate' />
          <Value Type='Date' >2021-08-31T22:00:00Z</Value>
          <FieldRef Name='EndDate' />
          <Value Type='Date' >2021-09-29T23:59:59Z</Value>

Its not returning above item from the list. But if I pass date which exactly matches with the date in list view(2021-09-30T23:59:59Z), then its returning the item.

It seems caml query is comparing value which is in list view and not in UTC one. Am I missing something here?

1 Answer 1


Modify your CAML Query to

     <FieldRef Name='StartDate' />
     <Value IncludeTimeValue='TRUE' Type='DateTime' StorageTZ='TRUE'>2021-08-31T22:00:00Z</Value>

Here, we have added the StorageTZ=TRUE attribute which tells SharePoint to do the comparison using the native storage time zone (UTC time) of the field value since all time values of date time fields are stored using UTC time.

  • Thanks this resolved the issue.
    – nbi
    Sep 30, 2021 at 8:41
  • Hi nbi. I'm glad I can help you solve the problem. Looking forward to our next cooperation. Sep 30, 2021 at 10:01

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.