NSString *formeDateString = @"2016-01-1"; NSDate *nowDate = [NSDate date]; NSDateFormatter *dateFormate = [[NSDateFormatter alloc]init]; [dateFormate setDateFormat:@"yyyy-MM-dd"]; NSDate *formeDate = [dateFormate dateFromString:formeDateString]; NSCalendar *dateCalendar = [[NSCalendar alloc]initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; NSDateComponents *components = [dateCalendar components:NSCalendarUnitDay fromDate:formeDate toDate:nowDate options:NSCalendarWrapComponents];
时间: 2024-10-10 16:39:46