0
這是我的數據字符串:從XML轉換字符串的NSDate以及如何將日期
<pubDate>Sun, 24 Mar 2013 00:42:13 +0200</pubDate>
我想將它轉換爲「太陽,24/3/13,00:42」 和將日期名稱翻譯爲希伯來語。
這裏是我到目前爲止的代碼:
currentPubDate = [self.xmlParser.pubDate objectAtIndex:indexPath.row];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
[dateFormatter setTimeStyle:NSDateFormatterNoStyle];
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];
NSLocale *loacle = [[NSLocale alloc]initWithLocaleIdentifier:@"he_IL"];
[dateFormatter setLocale:loacle];
[dateFormatter setDateFormat:@"EEE, dd MMM yyyy HH:mm:ss Z"];
[dateFormatter dateFromString:currentPubDate];
我應該怎麼做,使其工作?我讀過一些指南,但沒有成功。
很好的答案,試着用它來幫助我正在做的事情,你對如何調整它有什麼想法嗎?謝謝! http://stackoverflow.com/questions/25675839/rkvaluetransformers-failed-transformation-of-value-to-nsdate?noredirect=1#comment40162652_25675839 – 2014-09-06 00:34:57