【发布时间】:2012-08-24 19:32:20
【问题描述】:
不确定是什么问题,但我得到的不是月份名称“七月”,而是“07”。
dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setLocale:[NSLocale systemLocale]];
[dateFormat setTimeZone:[NSTimeZone localTimeZone]];
[dateFormat setDateFormat:@"MMMM dd, h:mm a"];
我尝试过 M、MM、MMM、MMMM,它们都给了我一个数字,而不是月份名称,尽管前导 0 的数量不同。
【问题讨论】:
-
我认为这行是问题.. [dateFormat setLocale:[NSLocale systemLocale]];不知道您使用
systemLocale的目的是什么,但您可以尝试使用currentLocale而不是systemLocale
标签: ios nsdate nsdateformatter