Reputation: 617
Is there any way/ method to seperate month & year form NSDate?
I just need to display current month & year? Any Example?
Upvotes: 1
Views: 11126
Reputation: 2468
NSDate *date = [NSDate date];
NSDateComponents *dateComponents = [calendar components:unitFlags fromDate:date];
NSInteger year = [dateComponents year];
NSInteger month = [dateComponents month];
[calendar release];
cheers endo
Upvotes: 6