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.
我想从 strftime 获取日期(当前时间)并将其转换为 obj-c 中用于 iphone-os 的 nsstring
我建议使用NSDate's descriptionWithCalendarFormat:timeZone:locale:。可以在此处找到有关该调用的更多文档。API 允许您指定要从某个日期输出到哪个组件NSString,这是该 API 的返回结果。
NSDate
descriptionWithCalendarFormat:timeZone:locale:
NSString
更新:如果你真的想使用,strftime那么const char*从该调用中获取 -typed 结果并NSString*使用stringWithUTF8String. 更多信息在这里。
strftime
const char*
NSString*
stringWithUTF8String
http://dblog.com.au/iphone-development/iphone-sdk-tip-function-for-getting-formatted-date-string-as-nsstring/