title: How to make an if statement using only a part of the date?
body: <p>I get a transaction date stamp from an API. The format is MM/dd/yyyy hh:mm:ss a (02/01/2014 11:41 23s AM) .</p>
  
  <p>So what i want to do is color the text of the transaction label in which the  object falls in according to the variance from a certain date. </p>
  
  <p>In my case, that certain date is the current time. </p>
  
  <p>So you can see below, that I have an if statement for this. However I don't want them to be how it currently is, because it limits the flexibility of the statement.</p>
  
  <p>My question is for two scenarios:
  1) How do I make the condition statement so  if the transactionDate is 1 hour away from the current date, datelabel.textcolor is red, else green.  </p>
  
  <p>2) If the transactionDate is not the same day ?</p>
  
  <p>I am having trouble determining how to implement these conditions. Please let me know how it's done in case 1 and case 2.</p>
  
  <p>You can see problem I have, the statement is so rigid, I can only make statements but they too accurate, and I want a wider/specific margin.</p>
  
  <p>Right now it is so specific, that if my goal is to make transactionDatetime one hour away, color textcolor green, I cannot because either datestring equals exact time like 2/01/2014 10:00 43s AM, or anything else is inequal. </p>
  
  <p>I want to make anything more than 1 hour inequal (colors anything beside green) and anything under 1 hour equal (textcolor green).</p>
  
  <p>I can take care of everything, just need help loosening this time frame. </p>
  
  <pre><code>        NSNumber *timestamp = [payment objectForKey:@"transactionDatetime"];
          NSDateFormatter *df = [[NSDateFormatter alloc] init];
          [df setDateFormat:@"MM/dd/yyyy hh:mm:ss a"];
  
  
          NSDate *date = [NSDate date];
          // format it
          NSDateFormatter *dateFormat = [[NSDateFormatter alloc]init];
          [dateFormat setDateFormat:@"MM/dd/yyyy hh:mm:ss a"];
          // convert it to a string
          NSString *dateString = [dateFormat stringFromDate:date];
          // free up memory
          [dateFormat release];
          //Try it
          NSLog(@"Todays date is = %@",dateString);
  
  
  
          if ([dateLabel.text isEqual:dateString]) {
              dateLabel.textColor = [UIColor colorWithRed:50/255.0f green:197/255.0f blue:0/255.0f alpha:1.0f];
          }
          else {
              dateLabel.textColor = [UIColor colorWithRed:68/255.0f green:140/255.0f blue:0/255.0f alpha:1.0f];
          }
          dateLabel.text = [df stringFromDate:[NSDate dateWithTimeIntervalSince1970:([timestamp floatValue]/1000)]];
          [df release];
  </code></pre>