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.
我对Objective C很陌生。
我以“YYYY-MM-DD”格式将日期从网络服务传递到应用程序(目标 C)。如何在 Objective C 中将其转换为日期格式?
一些帮助将不胜感激。:)
问候, SG
您可以使用“dateFromString”函数,如下所示:
NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"yyyy-MM-dd"]; NSDate *date = [formatter dateFromString:@"2012-02-06"]; [formatter release];