CAML and Date Formats

Patrick beat me to the punch and posted about date formatting with CAML (it was sitting in my blog TODO pile, I *knew* I should have blogged last night). The date format works alone and will return values. I just wanted to add to his post that you can add a time to the date as well if you want to a query for a particular time. For dates with time the format of the query has to be: 

<Query>

<Where>

<Leq>

<FieldRef Name="EventDate" />

<Value Type="DateTime">2005-05-27T16:00:00Z</Value>

</Leq>

</Where>

</Query>

 

So this would return all items in a list that has a field called EventDate with a value before 4:00PM on Friday, May 27, 2005.

1 Comment

Comments have been disabled for this content.