原文:http://www.jianshu.com/p/3bf520dcfd02

NSString *timeStr = @"2016-10-28 10:16";
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy-HH-dd HH:mm"];
[formatter setTimeZone:[NSTimeZone timeZoneWithName:@"UTC"]];
NSDate *date = [[NSDate alloc] init];
date = [formatter dateFromString:timeStr];
NSLog(@"%@",date);
网友评论