-(NSDate *)getPriousDateFromDate:(NSDate *)date withMonth:(int)month { NSDateComponents *comps = [[NSDateComponents alloc] init]; [comps setMonth:month]; NSCalendar *calender = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; NSDate *mDate = [calender dateByAddingComponents:comps toDate:date options:0]; [comps release]; [calender release]; return mDate; } NSDate *priousDate = [self getPriousDateFromDate:[NSDate date] withMonth:-3];
iphone 日期计算
最新推荐文章于 2023-06-15 19:14:56 发布