截取 与效率,
////生日数字的 转化 19900615
-(NSDate *)dateFromBirthDay:(NSString *)birthdayString
{
NSDateFormatter *formatter = [[NSDateFormatteralloc]init];
[formatter setDateFormat:@"yyyyMMdd"];
return [formatter dateFromString:birthdayString];
// NSRange yearRange = NSMakeRange(0, 4);
// int mYear = [[birthdayString substringWithRange:yearRange] intValue];
//
// NSRange monthRange = NSMakeRange(4, 2);
// int mMonth = [[birthdayString substringWithRange:monthRange] intValue];
//
// NSRange dayRange = NSMakeRange(6, 2);
// int mDay = [[birthdayString substringWithRange:dayRange]intValue];
// NSDateComponents *comp = [[NSDateComponents alloc]init];
// [comp setMonth:mMonth];
// [comp setDay:mDay];
// [comp setYear:mYear];
// NSCalendar *myCal = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
// NSDate *myDate = [myCal dateFromComponents:comp];
// return myDate;
}