array = (NSMutableArray *)[array sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formattersetDateFormat:@"yyyy-MM-dd"];
if(obj1 == [NSNullnull])
{
obj1 =@"0000-00-00";
}
if(obj2 == [NSNullnull])
{
obj2 =@"0000-00-00";
}
NSDate*date1 = [formatterdateFromString:obj1];
NSDate*date2 = [formatterdateFromString:obj2];
NSComparisonResultresult = [date1compare:date2];
returnresult ==NSOrderedAscending;
}];
网友评论