timeIntervalSinceNow
現在の時間との時間間隔を返します
解説
現在の時間との時間間隔を返します。
現在の時間の方が遅ければ、結果はマイナスで返されます。
返り値
( NSTimeInterval )
時間間隔
引数
フレームワーク
Foundation
クラス
NSDate
Instance Methods
使用可能
10.0
参照
- timeIntervalSinceDate:
- timeIntervalSince1970
- timeIntervalSinceReferenceDate
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { NSDate *theDate1 = [NSDate dateWithString:@"2002-12-03 04:56:00 +0900"]; NSLog([NSString stringWithFormat:@"%.1f",[theDate1 timeIntervalSinceNow]]); } @end