Type Method

date

Creates and returns a new date object set to the current date and time.

Declaration

+ (instancetype)date;

Return Value

A new date object set to the current date and time.

Discussion

This method uses the default initializer method for the class, init.

The following code sample shows how to use date to get the current date:

NSDate *today = [NSDate date];

See Also

Creating a Date

+ dateWithTimeIntervalSinceNow:

Creates and returns a date object set to a given number of seconds from the current date and time.

+ dateWithTimeInterval:sinceDate:

Creates and returns a date object set to a given number of seconds from the specified date.

+ dateWithTimeIntervalSinceReferenceDate:

Creates and returns a date object set to a given number of seconds from 00:00:00 UTC on 1 January 2001.

+ dateWithTimeIntervalSince1970:

Creates and returns a date object set to the given number of seconds from 00:00:00 UTC on 1 January 1970.