This class represents a date and time as the number
of seconds since the absolute reference date, which is defined as
midnight, January 1, 2001, GMT. This class allows you to compare
dates, compute time intervals between dates, and obtain string
representations of the NSDate object. The dates
represented by NSDate are not suitable for
presentation to human users. NSDateFormatter
objects are used by NSCell objects to convert raw
dates into human readable representations. If your application
requires the ability to work with date information in terms of a
calendar—that is, days, weeks, months, years, and so
on—the Foundation framework provides the
NSDate subclass NSCalendarDate.
@interface NSDate : NSObject <NSCoding, NSCopying>
|
// Convenience Constructors |
+ (id)date;
|
+ (id)dateWithString:(NSString *)aString;
|
+ (id)dateWithTimeIntervalSince1970:(NSTimeInterval)secs;
|
+ (id)dateWithTimeIntervalSinceNow:(NSTimeInterval)secs;
|
+ (id)dateWithTimeIntervalSinceReferenceDate:(NSTimeInterval)secs;
|
// Initializers |
- (id)init;
|
- (id)initWithString:(NSString *)description;
|
- (id)initWithTimeInterval:(NSTimeInterval)secsToBeAdded sinceDate:(NSDate *)anotherDate;
|
- (id)initWithTimeIntervalSinceNow:(NSTimeInterval)secsToBeAddedToNow;
|
- (id)initWithTimeIntervalSinceReferenceDate:(NSTimeInterval)secsToBeAdded;
|
// Class Methods |
+ (id)distantFuture;
|
+ (id)distantPast;
|
+ (id) dateWithNaturalLanguageString:(NSString *)string;
|
+ (id) dateWithNaturalLanguageString:(NSString *)string locale:(NSDictionary *)dict;
|
+ (NSTimeInterval)timeIntervalSinceReferenceDate;
|
// Instance Methods |
- (id)addTimeInterval:(NSTimeInterval)seconds;
|
- (NSComparisonResult)compare:(NSDate *)other;
|
- (NSCalendarDate *)dateWithCalendarFormat:(NSString *)format timeZone:(NSTimeZone *)aTimeZone;
|
- (NSString *)description;
|
- (NSString *)descriptionWithCalendarFormat:(NSString *)format timeZone:(NSTimeZone *)aTimeZone
locale:(NSDictionary *)locale;
|
- (NSString *)descriptionWithLocale:(NSDictionary *)locale;
|
- (NSDate *)earlierDate:(NSDate *)anotherDate;
|
- (BOOL)isEqualToDate:(NSDate *)otherDate;
|
- (NSDate *)laterDate:(NSDate *)anotherDate;
|
- (NSTimeInterval)timeIntervalSince1970;
|
- (NSTimeInterval)timeIntervalSinceDate:(NSDate *)anotherDate;
|
- (NSTimeInterval)timeIntervalSinceNow;
|
- (NSTimeInterval)timeIntervalSinceReferenceDate;
|
// Methods Implementing NSCoding |
- (void)encodeWithCoder:(NSCoder *)aCoder;
|
- (id)initWithCoder:(NSCoder *)aDecoder;
|
// Methods Implementing NSCopying |
- (id)copyWithZone:(NSZone *)zone;
|