IOS 6和NSDateFormatter [英] IOS 6 and NSDateFormatter
本文介绍了IOS 6和NSDateFormatter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下是代码:
NSString * str = @"2012-11-23Fri09:00:00+0100";
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
NSLocale *locale= [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
[formatter setLocale:locale];
[formatter setDateFormat:@"yyyy-MM-ddEEEHH:mm:ssZ"];
NSDate *result = [formatter dateFromString:str];
NSLog(@"str :%@ -- NSDate :%@", str, result);
这里是输出:
str :2012-11-23Fri09:00:00+0100 -- NSDate :1999-12-31 08:00:00 +0000
为什么 NSDate
错了?
推荐答案
查看此链接这可能会对您有所帮助,
See this Link this might help you,
谢谢,
Naveen Shan
Naveen Shan
这篇关于IOS 6和NSDateFormatter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文