I want to get a quarter value in NSDateComponents class
It seems that there is an issue with the NSQuarterCalendarUnit being ignored (haven’t verified, but did see a bug reported). Anyway, it is simple enough to get around… Just use the NSDateFormatter class. // After your NSDate *date, add… NSDateFormatter *quarterOnly = [[NSDateFormatter alloc]init]; [quarterOnly setDateFormat:@”Q”]; int quarter = [[quarterOnly stringFromDate:date] intValue]; // Then change … Read more