首页 > 其他 > 详细

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

时间:2014-02-21 02:55:42      阅读:393      评论:0      收藏:0      [点我收藏+]

    

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

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

原文:http://blog.csdn.net/ifziv/article/details/19543225

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!