Search code examples
sharepointsharepoint-2007windows-sharepoint-services

Trimming DateTime format to Just Date format in CAML Query


I am trying to build a CAML query for SharePoint 2007 environment, to get items from a calendar list. Want to query items with a given 'From date' and 'To date', the calendar list contains 'EventDate' and 'EndDate' in Datetime format. I am only interested in the date part of the datetime field.

How can I trim the "EventDate" DateTime field of Calendar list to just Date and compare?

Is there any other way to get this done apart from CAML.


Solution

  • Unfortunately you have to use CAML.

    You should be able to trim the time part...

    <Where>
       <Gt>
           <FieldRef Name='EventDate' />
           <Value IncludeTimeValue='FALSE' Type='DateTime'>2008-12-03T12:00:00Z</Value>
       </Gt>
    </Where>