I'm writing an SPSiteDataQuery
and I am having issues with the Query
property. I need to return all results where the Record_x0020_Yr_x0020_End_x0020_Date
is between 12/31 of the current year and 90 days prior.
Example: If I ran this query now, I should get all items where the date lies between 9/31/2011-12/31/2011. If I ran the query at any point next year, I should get 9/31/2012-12/31/2012. Here's what I have thus far:
query.Query = string.Format(@"
<Where>
<Eq>
<FieldRef Name='Record_x0020_Yr_x0020_End_x0020_Date' />
<Value Type='DateTime' IncludeTimeValue='FALSE'>{0}</Value>
</Eq>
</Where>", new DateTime(DateTime.Now.Year, 12, 31).ToString("yyyy-MM-dd"));
This gives me all those whose date is on the end of the year, but how do I add the range?