ftp.nice.ch/peanuts/GeneralData/Documents/openstep/OpenStepSpec_rtf.tar.gz#/OpenStepSpec_rtf/FoundationKit/Classes/NSDate.rtf

This is NSDate.rtf in view mode; [Download] [Up]

paperh18648 margl-907 margr0 margt0 margb0 fi0 ri0 ql sb0 f1 fs24 Copyright f3 'e3f1 1994 by NeXT Computer, Inc.  All Rights Reserved.

s4 li100 fi0 ri1007 ql f0 b fs36 fs100 
fs36 NSDate 
pard s11 li2872 fi-2771 ri1007 ql tx2872 f1 b0 fs28 fs48 
fs28 f0 b fs24 Inherits From:tab b0 fs28 f1 NSObject
fs20 
fs28 s6 f0 b fs24 Conforms To:tab b0 fs28 f1 NSCoding, NSCopying
fi0 NSObject (NSObject)
fs20 
fs28 s7 fi-2771 f0 b fs24 Declared In:tab b0 fs28 f1 Foundation/NSDate.h 
fs20 
fs28 pard s16 li100 fi0 ri1007 ql f0 b fs28 fs20 
fs28 Class Descrfs24 ifs28 ption
fs14 
fs28 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs2 
fs28 NSDate is an abstract class that provides behavior for creating dates, comparing dates, representing dates, computing time intervals, and similar functionality. It presents a programmatic interface through which suitable date objects are requested and returned. NSDate objects are lightweight and immutable since they represent a invariant point in time. This class is designed to provide the foundation for arbitrary calendrical representations. Its subclass NSCalendarDate offers date objects that are suitable for representing dates according to western calendrical systems.
fs16 
fs28 'aaDate'ba as used above implies clock time as well. The standard unit of time for date objects is a value typed as NSTimeInterval (a b doubleb0 ) and expressed as seconds. The NSTimeInterval type makes possible a wide and fine-grained range of date and time values, giving accuracy within milliseconds for dates 10,000 years apart.
fs16 
fs28 NSDate and its subclasses compute time as seconds i relativei0  to an absolute reference date. This reference date is the first instant of January 1, 2001. NSDate converts all date and time representations to and from NSTimeInterval values that are relative to this absolute reference date. A positive interval relative to a date represents a point in the future, a negative interval represents a time in the past.
fs16 
fs28 pard s12 li477 fi0 ri1007 ql f0 b fs24 Note:  b0 fs28 f1 Conventional UNIX systems implement time according to the Network Time Protocol (NTP) standard, which is based on Coordinated Universal Time. The private implementation of NSDate follows the NTP standard. However, this standard doesn'27t account for leap seconds and therefore isn'27t synchronized with International Atomic Time (the most accurate).
fs14 
fs28 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 fs2 
fs28 Like various other Foundation classes, NSDate lets you obtain operating-system functionality (dates and times) without depending on operating-system internals. It also provides a basis for the NSRunLoop and NSTimer classes, which use concrete date objects to implement local event loops and timers. 
fs16 
fs28 NSDate'27s sole primitive method, b timeIntervalSinceReferenceDateb0 , provides the basis for all the other methods in the NSDate interface. It returns a time value relative to an absolute reference date.
fs16 
fs28 pard s15 li477 fi0 ri1007 ql f0 b fs24 fs4 
fs24 Using NSDate
pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs28 fs16 
fs28 The date objects dispensed by NSDate give you a diverse range of date and time functionality. To obtain dates, send one of the b date...b0  messages to the NSDate class object. One of the most useful is b dateb0  itself, which returns a date object representing the current date and time. You can get new date objects with date and time values adjusted from existing date objects by sending b addTimeInterval:b0 .
fs16 
fs28 You can obtain relative date information by sending the b timeInterval...b0  messges to a date object. For instance, b timeIntervalSinceNowb0  gives you the time, in seconds, between the current time and the receiving date object. Compare dates with the b isEqual:b0 , b compare:b0 , b laterDate:b0 , and b earlierDate:b0  methods and use the b description b0 method to obtain a string object that represents the date in a standard international format.
fs16 
fs28 pard s16 li100 fi0 ri1007 ql f0 b fs24 
fs28 Creating an NSDate Object 
fs14 
fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 + (id)b allocWithZone:b0 (NSZone *)i zonei0 tab Allocates an unitialized NSDate in i zonei0 . Returns b nilb0  if allocation fails.
fi-6552 fs16 
fs28 fi-6552 + (NSDate *)b dateb0 tab Creates and returns an NSDate set to the current date and time.
fi-6552 fs16 
fs28 fi-6552 + (NSDate *)b dateWithTimeIntervalSinceNow:b0 (NSTimeInterval)i seconds
s9 li7030 fi-6553 fi-5796 i0 tab Creates and returns an NSDate set to i secondsi0  seconds from the current date and time.
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 + (NSDate *)b dateWithTimeIntervalSince1970:b0 (NSTimeInterval)i seconds
s9 li7030 fi-6553 fi-5796 i0 tab Creates and returns an NSDate set to to i secondsi0  seconds from the reference date used by UNIXf3 fs18 up6 'e2f1 fs28 up0 systems. Use a negative argument value to specify a date and time before the reference date.
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 + (NSDate *)b dateWithTimeIntervalSinceReferenceDate:b0 (NSTimeInterval)i seconds
s9 li7030 fi-6553 fi-5796 i0 tab Creates and returns an NSDate set to i secondsi0  seconds from the absolute reference date (the first instant of 1 January, 2001). Use a negative argument value to specify a date and time before the reference date.
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 + (NSDate *)b distantFutureb0 tab Creates and returns an NSDate that represents a date in the distant future (in terms of centuries). You can use this object in your code as a control date, a guaranteed outer temporal limit.
fi-6552 fs16 
fs28 fi-6552 + (NSDate *)b distantPastb0 tab Creates and returns an NSDate that represents a date in the distant past (in terms of centuries). You can use this object in your code as a control date, a guaranteed temporal boundary.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (id)b initb0 tab Initializes a newly allocated NSDate to the current date and time.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (id)b initWithString:b0 (NSString *)i descriptioni0 tab Returns an NSDate with a date and time value specified by the international string-representation format: YYYY-MM-DD HH:MM:SS f3 {f3 -}f1 HHMM, where f3 {f3 -}f1 HHMM is a time zone offset in hours and minutes from Greenwich Mean Time.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSDate *)b initWithTimeInterval:b0 (NSTimeInterval)i seconds
s9 li7030 fi-6553 fi-5796 i0 b sinceDate:b0 (NSDate *)i anotherDatei0 tab Returns an NSDate initialized relative to another date object by i secondsi0  (plus or minus).
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSDate *)b initWithTimeIntervalSinceNow:b0 (NSTimeInterval)i seconds
s9 li7030 fi-6553 fi-5796 i0 tab Returns an NSDate initialized relative to the current date and time by i secondsi0  (plus or minus).
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (id)b initWithTimeIntervalSinceReferenceDate:b0 (NSTimeInterval)i seconds
s9 li7030 fi-6553 fi-5796 i0 tab Returns an NSDate initialized relative to the reference date and time by i secondsi0  (plus or minus).
pard s16 li100 fi0 ri1007 ql f0 b fs48 
fs28 Converting to an NSCalendar Object
fs14 
fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (NSCalendarDate *)b dateWithCalendarFormat:b0 (NSString *)i formatString
s9 li7030 fi-6553 fi-5796 i0 b timeZone:b0 (NSTimeZone *)i timeZonei0 tab Returns an NSCalendarDate object bound to the format string i formatStringi0  and the time zone i timeZonei0 . If you specify b nilb0  after either or both of these arguments, the default format string and time zone are assumed.
pard s16 li100 fi0 ri1007 ql f0 b fs48 
fs28 Representing Dates
fs14 
fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (NSString *)b descriptionb0 tab Returns a string representation of the receiver. The representation conforms to the international format YYYY-MM-DD HH:MM:SS f3 {f3 -}f1 HHMM, where f3 {f3 -}f1 HHMM represents the time-zone offset in hours and minutes from Greenwich Mean Time (GMT).
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSString *)b descriptionWithCalendarFormat:b0 (NSString *)i formatString
s9 li7030 fi-6553 fi-5796 i0 b timeZoneb0 :(NSTimeZone *)i aTimeZonetab i0 Returns a string representation of the receiver. The
b locale:b0 (NSDictionary *)i localeDictionaryi0 tab tab representation conforms to i formatStringi0  (a b strftimeb0 -style date-conversion string) and is adjusted to i aTimeZonei0 . Included are the keys and values that represent the locale data from i localeDictionaryi0 .
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSString *)b descriptionWithLocale:b0 (NSDictionary *)i localeDictionary
s9 li7030 fi-6553 fi-5796 i0 tab Returns a string representation of receiver (see b descriptionb0 ). Included are the key and values that represent the locale data from i localeDictionaryi0 .
pard s16 li100 fi0 ri1007 ql f0 b fs48 
fs28 Adding and Getting Intervals
fs14 
fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 + (NSTimeInterval)b timeIntervalSinceReferenceDateb0 tab 
s9 li7030 fi-6553 fi-5796 tab Returns the interval between the system'27s absolute reference date and the current date and time. This value is less than zero until the first instant of 1 January 2001.
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} b addTimeInterval:b0 (NSTimeInterval)i secondsi0 tab Returns an NSDate that'27s set to a specified number of seconds relative to the receiver.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSTimeInterval)b timeIntervalSince1970b0 tab Returns the interval between the receiver and the reference date used by UNIXf3 fs18 up6 'e2f1 fs28 up0 systems.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSTimeInterval)b timeIntervalSinceDate:b0 (NSDate *)i anotherDate
s9 li7030 fi-6553 fi-5796 i0 tab Returns the interval between the receiver and i anotherDatei0 .
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSTimeInterval)b timeIntervalSinceNowb0 tab Returns the interval between the receiver and the current date and time.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSTimeInterval)b timeIntervalSinceReferenceDateb0 tab 
s9 li7030 fi-6553 fi-5796 tab Returns the interval between the receiver and the system'27s absolute reference date. This value is less than zero until the first instant of 1 January 2001.
pard s16 li100 fi0 ri1007 ql f0 b fs48 
fs28 Comparing Dates
fs14 
fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (NSComparisonResult)b compare:b0 (NSDate *)i anotherDate
s9 li7030 fi-6553 fi-5796 i0 fs28 tab fs28 Compares the receiver'27s date to that of i anotherDatei0  and returns NSOrderedDescending if the receiver is temporally later, NSOrderedAscending if it'27s temporally earlier, and NSOrderedSame if they are equal.
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSDate *)b earlierDate:b0 (NSDate *)i anotherDatei0 tab Compares the receiver'27s date to i anotherDatei0  and returns the one that'27s temporally earlier.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (BOOL)b isEqual:b0 (id)i anotherDatei0 tab Returns YES if i anotherDatei0  and the receiver are within one second of each other; otherwise, returns NO.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSDate *)b laterDate:b0 (NSDate *)i anotherDatei0 tab Compares the receiver'27s date to i anotherDatei0  and returns the one that'27s temporally later.
fi-6552 fs16 
fs28 fi-6552 
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.