macOS/iOS API解説

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

目次

timeIntervalSinceReferenceDate

グリニッジ標準時の2001年1月1日0時0分0秒と現在との差を秒数で返します

解説

グリニッジ標準時(GMT)の2001年1月1日0時0分0秒と現在の日付時間との差を秒数(NSTimeInterval)で返します。

返り値

( NSTimeInterval )

時間間隔

引数

クラス

NSDate

Class Methods

使用可能

10.0

参照

- timeIntervalSinceReferenceDate
- timeIntervalSinceDate:
- timeIntervalSince1970
- timeIntervalSinceNow

例文

#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 timeIntervalSinceReferenceDate]]);
 }
@end