// start by retrieving day, weekday, month and year components for yourDate NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier: NSGregorianCalendar]; NSDateComponents *todayComponents = [gregorian components:(NSDayCalendarUnit | NSMonthCalendarUnit | NSYearCalendarUnit) yourDate]; NSInteger theDay = [todayComponents day]; NSInteger theMonth = [todayComponents month]; NSInteger theYear = [todayComponents year]; // now build a NSDate object for yourDate using these components NSDateComponents *components = [[NSDateComponents alloc] init]; [components setDay:theDay]; [components setMonth:theMonth]; [components setYear:theYear]; NSDate *thisDate = [gregorian dateFromComponents:components]; [components release]; // now build a NSDate object for the next day NSDateComponents *offsetComponents = [[NSDateComponents alloc] init]; [offsetComponents setDay:1]; NSDate *nextDate = [gregorian dateByAddingComponents:offsetComponents toDate: yourDate options:0]; [offsetComponents release]; [gregorian release];
【上篇】【活动公告】LinkCoder主题社区活动上海站第一期 —— 面向分布式服务架构的实践
【下篇】C# OLEDBDATAADAPTER 配合 commandbuilder 连接数据库和dataset时注意事项
【下篇】C# OLEDBDATAADAPTER 配合 commandbuilder 连接数据库和dataset时注意事项