获取当前准确时间

2017-06-17  本文已影响14人  u14e
NSDate *date = [NSDate date];
NSTimeZone *zone = [NSTimeZone systemTimeZone];
NSTimeInterval interval = [zone secondsFromGMTForDate:date];
NSDate *current = [date dateByAddingTimeInterval:interval];
NSDate *date = [NSDate date];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss";
NSString *currentString = [formatter stringFromDate:date];

参考链接:http://www.jianshu.com/p/5f4e7fabcc02

上一篇 下一篇

猜你喜欢

热点阅读