1.获取当前时区的时间字符串
NSDate * date = [NSDate new];
NSDateFormatter * dateFormatter = [NSDateFormatter new];
[dateFormatter setDateFormat:@"yyyy:MM:dd - HH:mm:ss - Z"];
NSString * strDate = [dateFormatter stringFromDate:date];
NSLog(@"%@",strDate);
NSLog(@"%@",date);
输出如下:
2016-12-14 13:48:38.526 通讯录[9186:98149] 2016:12:14 - 13:48:38 - +0800
2016-12-14 13:48:38.528 通讯录[9186:98149] 2016-12-14 05:48:38 +0000
网友评论