i am having an issue with the example being used for array and mutable array. The examples have you use NSDate and methods to set objects with today, tomorrow and yesterays date. The problem i am having is getting yesterdays date set correctly.
I have it as [now dateByAddingTimeInterval: -24.0 * 60.0 * 60.0]; yet this doesnt appear to be returning the correct date?
//create three NSDate objects NSDate *now = [NSDate date]; NSDate *tomorrow = [now dateByAddingTimeInterval:24.0 * 60.0 * 60.0]; NSDate *yesterday = [now dateByAddingTimeInterval: -24.0 * 60.0 * 60.0]; //create an array containing all three (nil terminates the list) NSArray *datelist = [NSArray arrayWithObjects: now, tomorrow, yesterday, nil]; //print a couple NSLog(@"the first date is %@", [datelist objectAtIndex:0]); NSLog(@" the third date is %@", [datelist objectAtIndex:2]);
**on second look, its my *now that apperas to be off. throwing everything off by a day?