dateWithTimeIntervalSinceNow:
現在の日付と時間から指定した秒数で時間をつくって返します
+(id)dateWithTimeIntervalSinceNow:(NSTimeInterval)seconds:
解説
現在の日付、時間から指定した秒数分進んだ(遅れた)時間を返します。
未来の日付けはプラス、過去の日付けはマイナスをセットします。
【NSTimeInterval】
● 秒数をdouble数値で指定します。
返り値
( id )
時間(NSDate)
引数
( NSTimeInterval )seconds
時間間隔(秒)
フレームワーク
Foundation
クラス
NSDate
Class Methods
使用可能
10.0
参照
- initWithTimeIntervalSinceNow:
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { NSDate *theDate; theDate = [NSDate dateWithTimeIntervalSinceNow:3600]; //1時間後 [myOutlet setStringValue:[theDate description]]; } @end