Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在这里遇到了一些事情。我从我的 JSON 文件中得到以下日期格式:
2011-05-08 00:00:00
我需要把它转换成
"May 8"
帮助将不胜感激。
NSDateFormatter *formater = [[NSDateFormatter alloc] init]; [formater setDateFormat:@"yyyy-MM-dd hh:mm:ss"]; NSDate *date2 = [formater dateFromString:@"2011-05-08 00:00:00"]; [formater setDateFormat:@"MMM d"]; NSString *result = [formater stringFromDate:date2];