-2

iphone sdkコードで比較する日付と終了日を開始するには?

例:->

if ([nowdate compare:raceStartDate] == NSOrderedDescending && [nowdate compare:raceEndDate] == NSOrderedAscending)
{  

}
4

2 に答える 2

2
NSDate *date1;
NSDate *date2;


if ([date1 compare:date2] == NSOrderedDescending) {
    NSLog(@"date1 is later than date2");        

} else if ([date1 compare:date2] == NSOrderedAscending) {
    NSLog(@"date1 is earlier than date2");

} else {
    NSLog(@"dates are the same");

}
于 2013-10-29T05:07:56.197 に答える