NSDate 比较日期

Returns an NSComparisonResult value that indicates the temporal ordering of the receiver and another given date.code

- (NSComparisonResult)compare:(NSDate *)anotherDateit

Parameters anotherDateio

The date with which to compare the receiver. This value must not be nil. If the value is nil, the behavior is undefined and may change in future versions of Mac OS X.date

Return Valueim

If:di

The receiver and anotherDate are exactly equal to each other, NSOrderedSamevi

The receiver is later in time than anotherDate, NSOrderedDescendingco

The receiver is earlier in time than anotherDate, NSOrderedAscendingtime

相关文章
相关标签/搜索