The NSDate
class provides methods for creating NSDate
objects corresponding to a given date and time. An NSDate
can be initialized using the designated initializer, which:
Returns an
NSDate
object initialized relative to 00:00:00 UTC on 1 January 2001 by a given number of seconds.
NSDate *date = [[NSDate alloc] initWithTimeIntervalSinceReferenceDate:100.0];
NSDate
also provides an easy way to create an NSDate
equal to the current date and time:
NSDate *now = [NSDate date];
It is also possible to create an NSDate
a given amount of seconds from the current date and time:
NSDate *tenSecondsFromNow = [NSDate dateWithTimeIntervalSinceNow:10.0];