我知道 NSDateFormatter,但我希望它像“昨天 12:35”,而我只知道你连接了两个日期字符串?
[dateFormatter setTimeStyle:NSDateFormatterNoStyle];
[dateFormatter setDateStyle:NSDateFormatterShortStyle];
[dateFormatter setLocale: [NSLocale autoupdatingCurrentLocale]];
[dateFormatter setDoesRelativeDateFormatting:YES];
[dateFormatterTime setLocale:[NSLocale systemLocale]];
[dateFormatterTime setDateFormat:@"HH:mm"];
NSString *dateString = [NSString stringWithFormat:@"%@ %@", [dateFormatter stringFromDate:dateParsed], [dateFormatterTime stringFromDate:dateParsed ] ];
有任何想法吗?