iOS - 时间戳(时间流) 根据时区转化:

来源:互联网 发布:淘宝客买家怎么查询 编辑:程序博客网 时间:2024/05/17 22:53

    

    //根据文件结束的时间转时间戳算出开始的时间。    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];

0 0