在 Apple Docs 中,他们说 NSDateFormatter 使用 Unicode 作为规范。我已经阅读了规范,但我在解释这个日期时遇到了麻烦:
NSDateFormatter *frm = [[NSDateFormatter alloc] init];
[frm setDateFormat:@"EEE MMM dd HH:mm:ss ZZZ yyyy"];
NSLog(@"Tue Oct 13 09:24:15 +0000 2009 becomes %@", [frm dateFromString:@"Tue Oct 13 09:24:15 +0000 2009"]);
这段代码打印出来:
2009-10-13 11:37:40.334 test2[1704:20b] Tue Oct 13 09:24:15 +0000 2009 becomes (null)