我正在尝试使用[timeStamp objectAtIndex:indexPath.row];
目前它显示为:01.01.1970,timeStamp字符串看起来像“2013-07-19T17:19:06 + 02:00”;
NSString * timeStampString = [timeStamp objectAtIndex:indexPath.row];
NSTimeInterval _interval=[timeStampString doubleValue];
NSDate *date = [NSDate dateWithTimeIntervalSince1970:_interval];
NSDateFormatter *_formatter=[[NSDateFormatter alloc]init];
[_formatter setDateFormat:@"dd.MM.yyyy"];
NSString *_date=[_formatter stringFromDate:date];
cell.timeStampLabel.text = [NSString stringWithFormat:@"%@",_date ];
答案 0 :(得分:2)
NSDateFormatter * formatter = [[NSDateFormatter alloc] init];
[formatter setDateStyle:NSDateFormatterFullStyle];
您希望使用不同的日期格式化程序样式:
如果你也有时间,你想要设计风格
[formatter setTimeStyle:NSDateFormatterFullStyle];
我希望这会有所帮助