计算时间差

    NSDateFormatter *inputFormatter = [[NSDateFormatter alloc] init];

    [inputFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"zh_CN"]];

    [inputFormatter setDateFormat:@"yyyy.MM.dd  HH:mm:ss"];

    NSDate *inputDate = [inputFormatter dateFromString:self.time];

    NSDate *date = [NSDate date];

    NSTimeInterval secondsInterval= [date timeIntervalSinceDate:inputDate];

posted @ 2016-07-09 10:06  阳光普照大地  阅读(88)  评论(0编辑  收藏  举报