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