Instance Method

secondsFromGMT(for:)

Returns the difference in seconds between the receiver and Greenwich Mean Time at a given date.

Declaration

func secondsFromGMT(for aDate: Date) -> Int

Parameters

aDate

The date against which to test the receiver.

Return Value

The difference in seconds between the receiver and Greenwich Mean Time at aDate.

Discussion

The difference may be different from the current difference if the time zone changes its offset from GMT at different points in the year—for example, the U.S. time zones change with daylight saving time.

See Also

Getting Time Zone Information

var name: String

The geopolitical region ID that identifies the receiver.

var abbreviation: String?

The abbreviation for the receiver, such as “EDT” (Eastern Daylight Time).

func abbreviation(for: Date) -> String?

Returns the abbreviation for the receiver at a given date.

var secondsFromGMT: Int

The current difference in seconds between the receiver and Greenwich Mean Time.

var data: Data

The data that stores the information used by the receiver.

class var timeZoneDataVersion: String

Returns the time zone data version.

enum NSTimeZone.NameStyle

Constants you use to specify a style when presenting time zone names.

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