hi, i got a problem with my time interval. I need to get the interval of two times in this format : HH:MM. If i enter : 15:35 and 16:35 it is ok, but when i do 20:30 to 01:30, it gives me like 18 hours interval.. anyone have an idea?
NSString *startDate= starthere.text;
NSString *endDate = endhere.text;
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"HH:mm"];
NSDate *dateSelected = [dateFormatter dateFromString:startDate];
NSDate *dateSelected2 = [dateFormatter dateFromString:endDate];
[dateFormatter release];
if ([dateSelected2 earlierDate:dateSelected] == dateSelected2)
{
dateSelected2 = [dateSelected2 dateByAddingTimeInterval:86400];
}
interval = [dateSelected2 timeIntervalSinceDate:dateSelected];