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.
可能重复: 使用新格式将 NSString 转换为 NSDate
我有一个NSString @"Tue, 24 May 2011 0:05:01"值,我想将其转换为NSDate甲酸盐,如 dd/mm/yyyy 所以请建议我们如何做到这一点
NSString
NSDate
你必须做这样的事情
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"dd/mm/yyyy"]; NSString *dateString = [dateFormatter stringFromDate:DatePicker.date];
希望这可以帮助 !:)