-(NSString *)getchaWithBegin:(NSString *)begin WithEnd:(NSString *)end
{
[email protected]"20150615184030";
end= @"20150615204130";
NSCalendar *cal = [NSCalendar currentCalendar];
NSInteger unitFlag = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSWeekdayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit;
NSDateFormatter* df2 = [[NSDateFormatter alloc]init];
[df2 setDateFormat:@"yyyyMMddHHmmss"];//(格式自己定制)
NSDateComponents *d = [cal components:unitFlag fromDate:[df2 dateFromString:begin] toDate:[df2 dateFromString:end]options:0];
// int sec = [d hour]*3600+[d minute]*60+[d second];
// NSLog(@"second = %ld",[d hour]);
NSLog(@"%@",[NSString stringWithFormat:@"%ld小时%ld分",[d day]*24+[d hour],(long)[d minute]]);
return [NSString stringWithFormat:@"%ld小时%ld分",[d day]*24+[d hour],(long)[d minute]];
// 返回多少小时多少分钟
}