我必须从日期发送DDMMYYY日期才能与API通信。将NSDate格式化为DDMMYYYY?
NSDateComponents * dateComponents; NSCalendar * gregorian; NSDate * date;
gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
dateComponents = [[NSDateComponents alloc] init];
self.date = [gregorian dateByAddingComponents:dateComponents toDate:[NSDate date] options:0];
我是否必须使用[dateComponents day]等等?有没有什么方法可以帮助我像在PHP中一样执行该任务?
该代码运行得非常好:-)再次感谢您7KV7 – clement 2011-05-05 07:47:54
缺少分号;在NSLog声明的末尾,但其他方面完美无缺! – jsherk 2012-12-12 00:00:40