我有NSDateFormatter和iOS的問題。我居然發現了一個認可和這裏的問題的解釋:iOS 5打破NSDateFormatter?
http://www.cocoanetics.com/2011/12/ios-5-breaking-nsdateformatter/
然而,我的大腦是無法處理這些信息翻譯所有爲我的特定情況下的解決方案。我希望你們的朋友們能夠幫助我:
任何人都可以告訴我如何在iOS5中做以下工作嗎?它曾經被做工精細:
NSLocale *myLocale = [[NSLocale alloc] initWithLocaleIdentifier:@」en_GB」];
[inputFormatter setLocale: myLocale];
[myLocale release];
[inputFormatter setDateFormat:@"EEE, dd MMM yyyy HH:mm:ss Z"];
NSDate *formattedDate = [inputFormatter dateFromString: feedDateString];
NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init];
[outputFormatter setDateFormat:@"EEEE d MMMM"];
輸入的字符串,這是我無法控制,會像「星期二,2012年1月3日00:00:00 +0100「 當我登錄[outputFormatter stringFromDate:格式化日期]我得到空
原始的語言環境是「en_US」,但我改變了這一點,希望這會有所幫助。
這也將有助於在這個職位的人來說,這似乎是一條死衚衕後:
NSDateFormatter on ios 5 - any other way to use?
感謝,不幸的是,它不能解決我的問題。在你的例子中,你使用[NSDate date]。有了這個值,它的工作正常。所以,顯然,我必須檢查我的inputFormatter。 – Sjakelien 2012-01-26 13:16:23