【发布时间】:2010-02-16 15:44:42
【问题描述】:
这可能很简单。我找了,还没找到。
如何将 NSString @"20100216190205" 转换为格式为 @"yyyy-MM-dd HH:mm:ss" 的 NSString。
即:@"2010-02-16 19:02:05"
编辑: 在其他情况下,我想避免使用 NSDateFormatter 更通用。
【问题讨论】:
-
你为什么不想使用 NSDateFormatter?它们实施起来并不难,而且是专门为此目的而设计的。见:developer.apple.com/mac/library/documentation/Cocoa/Conceptual/…
-
为什么说“不使用 NSDateFormatter”?只是因为你的例子不起作用?你是如何创建格式化程序的?
-
有编辑。我希望它更清楚。
标签: iphone nsstring nsdate nsdateformatter nsdatecomponents