How do I compare in objective C to see if a certain time and date period overlaps another that is already in a plist for example?
This is most commonly used in booki
Try this to Compare ..
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"MM/dd/yyyy hh:mm:ss aa"];
NSDate *dateOne=[dateFormat dateFromString:@"01/09/2011 11:12:10 AM" ];
NSDate *dateTwo = [NSDate date];
switch ([dateOne compare:dateTwo]){
case NSOrderedAscending:
//NSLog(@"NSOrderedAscending");
break;
case NSOrderedSame:
//NSLog(@"NSOrderedSame");
{
break;
case NSOrderedDescending:
//NSLog(@"NSOrderedDescending");
break;
}
[dateFormat release];