ios - Sort an array of dates to extract every sundays -


I am quite new to iOS and I was wondering how to remove from an NSMutableArray as stars in the form of stars (in the form of wire) all that Sunday can be.

From my research I have come to know that I have to start from today's date in this way

  NSDate * now = [NSDate date]; NSCalendar * Calendar = [[NSCalendar alloc] initWithCalendarIdentifier: NSGregorianCalendar];  

Then select "Like" on Sunday

  NSDateComponents * dateComponents = [Calendar component: NSWeekdayCalendarUnit | NSHourCalendarUnit From Date: Now]; NSInteger on weekdays = [dateComponents1]; // 1 is correct on Sunday?  

Then go back in the past and put every Sunday in a new array or in another place.

NSDate * dateRelease; NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init]; [Dateformer settimezone: [nystimjon timezone wit: bb: @ "UTC"]]; [DateFormatter setDateFormat: @ "yyyy-MM-dd"]; (Ii) i date drawing]]; // Check here for Sunday if ([compare now: dateRelease] == NSOrderedDescending) {// put on Sunday in new array} else {// if not Sunday, go with loop}}

And for this I am in a bit confused to coordinate to get on Sundays (up to November 1, 2013 my array goes on) ...

Your help Thank you for

VV

As the first date < Store> code> NSDate Mesha should store data using the appropriate data type:

  NSArray * datesAsStrings = ...; NSMutableArray * Date = [NSMutableArray new]; NSDateFormatter * dateFormatter = [NSDateFormatter new]; DateFormatter.timeZone = [NSTimeZone timezoneWithbab: @ "UTC"]; DateFormatter.dateFormat = @ "yyyy-MM-dd"; (SSTRings in NSString * dateStr dates) {NSDT * date = [dateform date: framestring: date STR]; [Date added objects: Dates]; }  

and then filter on Sunday:

  NSMutableArray * sundays = [NSMutableArray new]; [Tell Date on ObjectSpeaking Block: (Zero (^) (ID, OGJ, NSUnitezer IDX, BOL * stop)) {NSDT * date = (NSDT *) OBG; NSCalendar * Calendar = [NSCalendar Current Calendar]; NSDateComponents * comps = [Calendar component: NSWeekdayCalendarUnit by date: Date]; If (comps.weekday == 1) [Sunday addObject: date]; }];  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -