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.
我想以“2013 年 5 月 31 日星期五 12:00 pm”等格式检索日期和时间。如何使用 NSDateFormatter 实现这一目标?
NSDate *myDate = datePicker.date; NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setDateFormat:@"cccc, MMM d, hh:mm aa"]; NSString *prettyVersion = [dateFormat stringFromDate:myDate];