Creating an NSDate

suggest change

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];

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


NSDate:
*Creating an NSDate

Table Of Contents