Instance Method

initWithTimeIntervalSince1970:

Returns a date object initialized relative to 00:00:00 UTC on 1 January 1970 by a given number of seconds.

Declaration

- (instancetype)initWithTimeIntervalSince1970:(NSTimeInterval)secs;

Parameters

seconds

The number of seconds from the reference date (00:00:00 UTC on 1 January 1970) for the new date. Use a negative argument to specify a date and time before the reference date.

Return Value

An NSDate object set to seconds seconds from the reference date.

Discussion

This method is useful for creating NSDate objects from time_t values returned by BSD system functions.

See Also

Initializing a Date

- init

Returns a date object initialized to the current date and time.

- initWithTimeIntervalSinceNow:

Returns a date object initialized relative to the current date and time by a given number of seconds.

- initWithTimeInterval:sinceDate:

Returns a date object initialized relative to another given date by a given number of seconds.

- initWithTimeIntervalSinceReferenceDate:

Returns a date object initialized relative to 00:00:00 UTC on 1 January 2001 by a given number of seconds.

- initWithCoder:

Returns a date object initialized from data in the given unarchiver.