Objective-C 基础
来源:互联网 发布:淘宝开店名字 编辑:程序博客网 时间:2024/05/17 08:19
/* NSDate.h Copyright (c) 1994-2013, Apple Inc. All rights reserved. */ #import @class NSString; FOUNDATION_EXPORT NSString * const NSSystemClockDidChangeNotification NS_AVAILABLE(10_6, 4_0); typedef double NSTimeInterval; //因为是double类型的所以输出时要用NSLog(@"%lf", timeInterval); #define NSTimeIntervalSince1970 978307200.0@interface NSDate : NSObject- (NSTimeInterval)timeIntervalSinceReferenceDate; @end @interface NSDate (NSExtendedDate) - (NSTimeInterval)timeIntervalSinceDate:(NSDate *)anotherDate; //两个日期之间相隔多少秒 - (NSTimeInterval)timeIntervalSinceNow; // 日期距离现在相隔多少秒 - (NSTimeInterval)timeIntervalSince1970;// 日期距离1970年1月1日0点相隔多少秒 - (id)addTimeInterval:(NSTimeInterval)seconds NS_DEPRECATED(10_0, 10_6, 2_0, 4_0);//此方法已经过时了 但是效果是和下面的方法一样的 - (id)dateByAddingTimeInterval:(NSTimeInterval)ti NS_AVAILABLE(10_6, 2_0);//返回现在的时间往后ti秒 如果是负数则是往前ti秒 - (NSDate *)earlierDate:(NSDate *)anotherDate; //两个时间相比较返回较早的时间 - (NSDate *)laterDate:(NSDate *)anotherDate;//两个时间比较返回比较迟的时间 - (NSComparisonResult)compare:(NSDate *)other;//比较两个时间self比other迟返回NSOrderedAscending(-1,小于)self比other早返回NSOrderedDescending(1,大于)相等NSOrderedSame(0) - (BOOL)isEqualToDate:(NSDate *)otherDate;//返回两个时间是否相等 - (NSString *)description;//返回形容的一个字符串:2014-11-02 22:44:22 +0000 - (NSString *)descriptionWithLocale:(id)locale; + (NSTimeInterval)timeIntervalSinceReferenceDate;// 以2001/01/01 GMT为基准时间,返回实例保存的时间与2001/01/01 GMT的时间间隔 @end @interface NSDate (NSDateCreation) + (instancetype)date;//返回当前的时间 + (instancetype)dateWithTimeIntervalSinceNow:(NSTimeInterval)secs;//返回以现在的时间为基准时间,往前(secs>0)或往后(secs < 0)|secs|秒的日期 + (instancetype)dateWithTimeIntervalSinceReferenceDate:(NSTimeInterval)ti; //返回以2001/01/01 GMT的时间为基准时间,往前(secs>0)或往后(secs < 0)|secs|秒的日期 + (instancetype)dateWithTimeIntervalSince1970:(NSTimeInterval)secs; //返回以1970/01/01 GMT的时间为基准时间,往前(secs>0)或往后(secs < 0)|secs|秒的日期 + (instancetype)dateWithTimeInterval:(NSTimeInterval)secsToBeAdded sinceDate:(NSDate *)date; //返回以date 的时间为基准时间,往前(secs>0)或往后(secs < 0)|secs|秒的日期 + (id /* NSDate * */)distantFuture;// 随机返回一个比较遥远的未来时间 + (id /* NSDate * */)distantPast;// 随机返回一个比较遥远的以前时间 - (instancetype)init; /* designated initializer *///初始化 //下面的初始化和上面的一样 - (instancetype)initWithTimeIntervalSinceReferenceDate:(NSTimeInterval)ti; /* designated initializer */ - (instancetype)initWithTimeIntervalSinceNow:(NSTimeInterval)secs; - (instancetype)initWithTimeIntervalSince1970:(NSTimeInterval)secs; - (instancetype)initWithTimeInterval:(NSTimeInterval)secsToBeAdded sinceDate:(NSDate *)date; @end
0 0
- Objective-C基础概要
- Objective-C 基础语法
- Objective C - 基础:
- Objective-C 基础语法
- Objective-C Foundation基础
- Objective-C入门基础
- OBJECTIVE-C语言基础
- Objective-C类 基础
- objective c 基础
- objective-c语法基础
- Objective-C 基础
- Objective-C 基础
- Objective-c基础
- Objective-C 基础
- 【Objective-C】OC基础
- objective-c基础
- objective-c之基础
- Objective-C基础知识点
- Lua中的数学库
- 利用数组操作实现灰度图像放大两倍(C++&opencv)
- crontab 调用shell脚本调用jar,导致进程一直没释放
- C++中的this的个人理解
- 营销在移动客户端
- Objective-C 基础
- ubuntu mysql远程连接问题解决方法
- 第十周 项目二--M$pszi$y是嘛意思---不知加密数字,列出所有可能
- 盒子游戏
- 华为机试20141103
- 系统安全原则:最小特权
- python元类分析
- 《unix高级环境编程》文件和目录——文件时间
- 通过wifi向服务器端发送数据