title: NSDate, comparing two dates
body: <p>Ok, I have been working on this for a couple of days now and am stuck. What I am trying to do is compare the current time with a predetermined time. What I want to happen is, Everyday at certain times I want certain code to fire, but not before the time of day that I specify.</p>
  
  <p>so, basically if the "current time" is the same or equal to "predetermined time" then fire this code. Or fire this line of code.</p>
  
  <p>Sounds simple, but I am having trouble grabbing comparing the two times.</p>
  
  <p>I have formatted a string to a date like so</p>
  
  <pre><code>     NSString* dateString = @"11:05 PM";
          NSDateFormatter* firstDateFormatter = [[[NSDateFormatter alloc] init] autorelease];
          [firstDateFormatter setDateFormat:@"h:mm a"];
          [firstDateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
          NSDate* date = [firstDateFormatter dateFromString:dateString];
          NSLog(@"date %@",date);
  </code></pre>
  
  <p>then i grab the current time like so</p>
  
  <pre><code>   NSDate *currentTime = [NSDate dateWithTimeIntervalSinceNow:[[NSTimeZone localTimeZone]     secondsFromGMT]];
  NSDateComponents* comps = [[NSCalendar currentCalendar] 
                             components: NSHourCalendarUnit |NSMinuteCalendarUnit 
                                  |NSSecondCalendarUnit fromDate:currentTime];
   [[NSCalendar currentCalendar] dateFromComponents:comps];
  </code></pre>
  
  <p>SO how do I compare these two times? I have tried everything I can think of, please help.</p>