Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何解析日期字符串_Iphone_Objective C - Fatal编程技术网

Iphone 如何解析日期字符串

Iphone 如何解析日期字符串,iphone,objective-c,Iphone,Objective C,我使用此代码从格式为“01-05-2011”的字符串中获取信息 然后当我取这个月的[comps day],[comps month],我有1和5,我想要01,05。有人能帮我吗?thanx这些组件是,它们没有格式化。在字符串中使用时,可以执行以下操作: NSString *day = [NSString stringWithFormat:@"%02d", [comps day]]; 类似于 //UNTESTED [NSString stringWithFormat:@"%02d", [comp

我使用此代码从格式为“01-05-2011”的字符串中获取信息

然后当我取这个月的[comps day],[comps month],我有1和5,我想要01,05。有人能帮我吗?thanx

这些组件是,它们没有格式化。在字符串中使用时,可以执行以下操作:

NSString *day = [NSString stringWithFormat:@"%02d", [comps day]];
类似于

//UNTESTED
[NSString stringWithFormat:@"%02d", [comps day]];

请奖励在过去和将来帮助过你的人。谢谢。@DarkDust我总是接受答案!你为什么告诉我这个,因为这个问题包括,你已经接受了你十个问题中两个的答案。你的许多问题都有可以接受的有效答案:。
//UNTESTED
[NSString stringWithFormat:@"%02d", [comps day]];