I am writing a view for a list of events in SharePoint (Schema.xml) and I want to filter the results according to a DateTime (i.e. only display the events that start between 2 dates)
Normally I would use a CAML Query like this one for example :
<Where>
<And>
<Geq>
<FieldRef Name="Event_x0020_Start_x0020_Date" />
<Value Type=”DateTime”>2009-10-10T10:00:00Z</Value>
</Geq>
<Leq>
<FieldRef Name="Event_x0020_Start_x0020_Date" />
<Value Type=”DateTime”>2009-11-10T10:00:00Z</Value>
</Leq>
</And>
</Where>
However, in this case, the dates that I want to compare to are not available directly in a field, I have to fetch them from the Query String.
I tried using
<Value Type="DateTime">
<GetVar Scope="Request" Name="Start" />
</Value>
<Value Type="DateTime">
<GetVar Scope="Request" Name="End" />
</Value>
where Start and End are 2 dates in the Query String (I tried every date format, with and without the Type="DateTime") but I always get empty results. The query works fine when I hardcode my dates (with say 2009-10-10T10:00:00Z).
I have control over what I send in the Query String so I can change it if there is another way.
So is there a way to get a DateTime format in the query string? If not, do I have other options?
Thanks!