A SPQuery can be used to retrieve some SPListItems from a SPListItemCollection. The following code is an example which shows how to do a DateTime comparison. It is very important to use a correct date format as the value in the inner xml of the where clause.
SPList contacts = SPControl.GetContextWeb(Context).Lists["SomeContactList"];
SPQuery = new SPQuery();
query.ViewFields = "<FieldRef Name='LastChange' />";
query.Query = "<Where><Eq><FieldRef Name='LastChange' /><Value Type='DateTime'>1971-01-01T00:00:00Z</Value></Eq></Where>";
or with the current datetime you could use:
query.Query = String.Format("<Where><Gt><FieldRef Name='Modified'/>" + "<Value Type='DateTime' StorageTZ='TRUE'>{0}</Value></Gt></Where>", SPUtility.CreateISO8601DateTimeFromSystemDateTime(DateTime.UtcNow));
foreach(SPListItem item in contacts.GetItems(query))
{
...
}
The format of the value is in xml/sql format: 1971-01-01T00:00:00Z