Name
NSDate — Mac OS X 10.0
Synopsis
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
.
NSDate
is toll-free bridged with the Core
Foundation type CFDate
. As such,
NSDate
objects can be used interchangeably with
the CFDate
pointer type,
CFDateRef
.
See the NSCalendarDate
class description for more
information. Additionally, Chapter 2 provides more
detailed information on the use of NSDate
.
|
@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 ... |
Get Cocoa in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.