您应该NSCalendar为此目的使用,因为日期的月份取决于所使用的日历.这大部分时间都是格里高利历,但是啊,让我们超级正确.:)
NSCalendar *cal = [NSCalendar currentCalendar];
NSDateComponents comps = [cal components:NSMonthCalendarUnit fromDate:myDate];
NSLog(@"The month is: %d", [comps month]);
Run Code Online (Sandbox Code Playgroud)