我必须从Date发送DDMMYYY日期以与API通信 .
NSDateComponents * dateComponents; NSCalendar *格里高利; NSDate *日期;
gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
dateComponents = [[NSDateComponents alloc] init];
self.date = [gregorian dateByAddingComponents:dateComponents toDate:[NSDate date] options:0];
我必须使用[dateComponents日]等等吗?是否有一些方法可以帮助我像PHP一样执行该任务?
7 回答
只是:
试试这个
试试这段代码:
检查iphonetips,stackoverflow,apple reference
试试这个:
同意 Ruben Esposito
只需像这样更改您的代码 .