//根据文件结束的时间转时间戳算出开始的时间。 NSDate *dates = _gatherRecord.gatherTime; //得到时间 NSTimeInterval ti = [dates timeIntervalSince1970]; //转时间戳 NSTimeInterval ends = ti - [_gatherRecord.gatherDuration intValue]; NSDate *conformTime = [NSDate dateWithTimeIntervalSince1970:ends]; //根据当地时间把时间戳转为当地时间 NSTimeZone *zone = [NSTimeZone systemTimeZone]; NSInteger interval = [zone secondsFromGMTForDate:conformTime]; NSDate *localeDate = [conformTime dateByAddingTimeInterval: interval];
原文:http://blog.csdn.net/ifziv/article/details/19543225