How to get month & year from NSDate?
Is there any way/ method to seperate month & year form NSDate?
I just need to display current month & ye开发者_StackOverflow中文版ar? Any Example?
NSDate *date = [NSDate date];
NSDateComponents *dateComponents = [calendar components:unitFlags fromDate:date];
NSInteger year = [dateComponents year];
NSInteger month = [dateComponents month];
[calendar release];
cheers endo
This could be done by using NSDateComponents
精彩评论