iDev
iDev

Reputation: 478

Tomorrow in NSDateComponents isolate day

I'm trying to retrieve tomorrows date based on the current date. I get the correct string, but how do I isolate the day?

NSDateComponents *comps = [[NSDateComponents alloc] init];
[comps setDay:1];
NSDate *tommorrow = [cal dateByAddingComponents:comps toDate:[NSDate date]  options:0];
[comps release];

NSLog(@"%@", tommorrow);

Returns a string of: 2011-10-01 15:07:07 +0000

Upvotes: 1

Views: 217

Answers (1)

EmptyStack
EmptyStack

Reputation: 51374

You can get the day like this,

NSDateComponents *dcs = [cal components:NSDayCalendarUnit fromDate:tomorrow];
int day = [dcs day];

Upvotes: 1

Related Questions