Instance Method

addTimeInterval(_:)

Returns a new date object that is set to a given number of seconds relative to the receiver.

Declaration

func addTimeInterval(_ seconds: TimeInterval) -> Any

Parameters

seconds

The number of seconds to add to the receiver. Use a negative value for seconds to have the returned object specify a date before the receiver.

Return Value

A new NSDate object that is set to seconds seconds relative to the receiver. The date returned might have a representation different from the receiver’s.

See Also

Legacy Operations

class func date(withNaturalLanguageString: String) -> Any?

Creates and returns a date object set to the date and time specified by a given string.

Deprecated
class func date(withNaturalLanguageString: String, locale: Any?) -> Any?

Creates and returns a date object set to the date and time specified by a given string.

Deprecated
class func date(with: String) -> Any

Creates and returns a date object with a date and time value specified by a given string in the international string representation format (YYYY-MM-DD HH:MM:SS ±HHMM).

Deprecated
init?(string: String)

Returns a date object initialized with a date and time value specified by a given string in the international string representation format.

Deprecated
func date(withCalendarFormat: String?, timeZone: TimeZone?) -> NSCalendarDate

Converts the receiver to a calendar date with a given format string and time zone.

Deprecated
func description(withCalendarFormat: String?, timeZone: TimeZone?, locale: Any?) -> String?

Returns a string representation of the date formatted as specified by given conversion specifiers.

Deprecated

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software