我正在尝试以 MM/dd 格式显示推文的日期,但它返回 null。longDate 很好,并以该长格式显示正确的日期。
NSDate *createdDate = [NSDate dateWithTimeIntervalSince1970:[[[sortedEvents objectAtIndex:indexPath.row] objectForKey:@"created_time"] doubleValue]];
NSString *dateString = [NSString stringWithFormat:@"%@", createdDate];
[dateFormat setDateFormat:@"yyyy-MM-dd HH:mm:ss ZZZ"];
NSDate *longDate = [dateFormat dateFromString: dateString];
[dateFormat setDateFormat:@"MM/dd"];
NSString *dateString2 = [NSString stringWithFormat:@"%@", longDate];
NSDate *condensedDate = [dateFormat dateFromString:dateString2];