Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
像这样的字符串所需的 NSFormat 是什么?
格林威治标准时间 2012 年 6 月 15 日星期五 15:37:38
我正在尝试从中创建一个 NSDate 对象。谢谢
使用以下
NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"EEE, dd MMM yyyy HH:mm:ss z"]; NSDate *date = [formatter dateFromString:@"Fri, 15 Jun 2012 15:37:38 GMT"]; NSLog([date description]); //2012-06-15 15:37:38 +0000