get date from an nsdictionary and match them
<p>I am using nsdictionary to store dates.I am trying to give certain dates from my testcase and get the dates from the dictionary.Say ,my dictionary has 10 dates.I wish to match 3 dates and get only the 3 dates from the dictionary.I am unable to do that.Can anyone tell me how I can do that?I am getting all the 10 dates even I try to get the 3 dates.well,heres my codeif(([dd1 laterDate:startDate] || [dd1 isEqualToDate:startDate]) &amp;&amp; 
                       ([dd1 earlierDate:endDate] || [dd1 isEqualToDate:endDate] ) )
                    {<br>
                         if ([startDate earlierDate:dd1] &amp;&amp; [endDate earlierDate:dd1])</p>

<pre><code>                   {    


                        //dd==startDate;
                        NSManagedObject *allnew = Nil;
                        NSManagedObjectContext *allone=[self managedObjectContext];            
                        NSEntityDescription *entity = [NSEntityDescription entityForName:@"Weather" inManagedObjectContext:allone];   
                        NSLog(@" The NEW ENTITY IS ALLOCATED AS entity is %@",entity);
                        WeatherXMLParser *delegate = [[WeatherXMLParser alloc] initWithCity:city state:state country:country];
                        NSXMLParser *locationParser = [[NSXMLParser alloc] initWithContentsOfURL:delegate.url];
                        [locationParser setDelegate:delegate];
                        [locationParser setShouldResolveExternalEntities:YES];
                        [locationParser parse];
                        NSFetchRequest *request = [[NSFetchRequest alloc] init];  
                        [request setEntity:entity]; 

                        predicate = [NSPredicate predicateWithFormat:
                                     @"city == %@ and state == %@ and country == %@  and date==%@ and date==%@", city, state, country,startDate,endDate];

                        [request setPredicate:predicate];
                        NSError *err;
                        NSUInteger count = [allone countForFetchRequest:request error:&amp;err];
                        NSLog(@" minimum salary is %@",predicate);
                        // If a predicate was passed, pass it to the query
                        if(predicate !=NULL){

                            //[self deleteobject];
                        }

                        Weather *weather = (Weather *)[NSEntityDescription insertNewObjectForEntityForName:@"Weather" 
                                                                                    inManagedObjectContext:self.managedObjectContext];
                        weather.date = [fields objectForKey:@"date"];
                        weather.high =[fields objectForKey:@"high"];
                        weather.low = [fields objectForKey:@"low"];
                        weather.city =[fields objectForKey:@"city"];
                        weather.state =[fields objectForKey:@"state"];
                        weather.country =[fields objectForKey:@"country"];
                        NSString*icon=[fields objectForKey:@"icon"];
                        NSString *all=[icon lastPathComponent];
                        weather.condition = all;

                        [self saveContext]; 
</code></pre>

<p>I wish to get only 2 dates but I am getting all 4 elements from nsdictionary.I am passing my startdate and enddate from the testcase and I am getting dates from google weather api using nsxmlparser and storing them in nsdictionary.I am getting the first date and incrementing each date and storing them.My NSdictionary looks likegot {
    city = #;
    condition = "Mostly Sunny";
    country = #;
    date = "2011-08-11 05:00:00 +0000";
    "day_of_week" = Thu;
    high = 81;
    icon = "/ig/images/weather/mostly_sunny.gif";
    low = 65;
    startdate = "2011-08-11 05:00:00 +0000";
    state = #;</p>
