我正在使用下面的代码。
NSString * weekdayString = [[self date] descriptionWithLocale:@"%A"];
NSLocale *usLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setLocale:usLocale];
[dateFormatter setDateStyle:NSDateFormatterShortStyle];
dateString = [NSString stringWithFormat:@"%@,%@",weekdayString,[dateFormatter stringFromDate:[self date]]];
NSArray * components = [dateString componentsSeparatedByString:@","];
dateString = [NSString stringWithFormat:@"%@,%@",[components objectAtIndex:0],[components objectAtIndex:1]];
它在模拟器和 ios 6.0 中运行良好,但在设备(iPad)中的 ios 5.1 中没有按预期显示。