I would like to filter a list based on the year as parameter. For e.x. if i use 2014, all items from 1/1/2014 to 31/12/2014 should appear and also i am filtering on region. For the caml query below, if there is an item which was entered on 1/1/2014, it does not show up.Any idea why...

        <FieldRef Name='Region' />
        <Value Type='Lookup'>A1.1</Value>
           <FieldRef Name='DueDate' />
           <Value IncludeTimeValue='FALSE' Type='DateTime'>2014-01-01</Value>
           <FieldRef Name='DueDate' />
           <Value IncludeTimeValue='FALSE' Type='DateTime'>2014-12-31</Value>
  <FieldRef Name='DueDate' Ascending='False' />

1 Answer 1


You need to use the ISO 8601 DateTime format:


Even if you aren't comparing against the time value, the ISO 8601 format is still expected.

Given DateTime dueDate You can use:

<Value IncludeTimeValue='FALSE' Type='DateTime'>dueDate.ToString("yyyy-MM-ddTHH:mm:ssZ")</Value>

Or the SPUtility.CreateISO8601DateTimeFromSystemDateTime() method:

<Value IncludeTimeValue='FALSE' Type='DateTime'>SPUtility.CreateISO8601DateTimeFromSystemDateTime(dueDate)</Value>

See SharePoint 2010 Working with Dates in CAML

  • Like this solutions but how can i offset the dates using any of these methods?
    – naijacoder
    Dec 18, 2014 at 5:38

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.