I want to compare dates, but my code isn't working.
$spQuery = New-Object Microsoft.SharePoint.SPQuery; $camlQuery = "<Query><Where><Lt><FieldRef Name='DocumentDate'/><Value Type='DateTime' IncludeTimeValue='False'>$expireyDate</Value></Lt></Where></Query>"; $spQuery.Query = $camlQuery $sourceItems = $sourceList.GetItems($spQuery)
and the value of
1/1/2008. I want to get all items who's field value 'DocumentDate' (which is a date field) is less than the expiry date.
It just returns all the items in the list, and doesn't filter.
Does anyone know what's wrong?