macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

earlierDate:

二つの日付を比較して、より早い(過去の)日付を返します
-(NSDate *)earlierDate:(NSDate *)anotherDate:

解説

二つの日付を比較して、より早い(過去の)日付を返します。

返り値

( NSDate * )

時間

引数

( NSDate * )anotherDate

時間

クラス

NSDate

Instance Methods

使用可能

10.0

参照

- compare:
- isEqual:(NSObject protocol)
- laterDate:

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{
NSDate *theDate1 = [NSDate dateWithString:@"2002-12-03 04:56:00 +0900"];
NSDate *theDate2 = [NSDate dateWithString:@"2002-12-04 04:56:00 +0900"];

NSLog([[theDate1 earlierDate:theDate2] description]);
   
}

@end