Skip to content

Structure

Date

iOS 8.0+ iPadOS 8.0+ Mac Catalyst 8.0+ macOS 10.10+ tvOS 9.0+ watchOS 2.0+
A specific point in time, independent of any calendar or time zone.
struct Date

Overview

A Date value encapsulates a single point in time, independent of any particular calendrical system or time zone. Date values represent a time interval relative to an absolute reference date.

The Date structure provides methods for comparing dates, calculating the time interval between two dates, and creating a new date from a time interval relative to another date. Use date values in conjunction with DateFormatter instances to create localized representations of dates and times and with Calendar instances to perform calendar arithmetic.

Date bridges to the NSDate class. You can use these interchangeably in code that interacts with Objective-C APIs.

Topics

Structures

Operators

Initializers

Instance Properties

Instance Methods

Type Properties

Default Implementations

Relationships

Conforms To

  • Configuration.ExpressibleByConfigString
  • Swift.Comparable
  • Swift.Copyable
  • Swift.CustomDebugStringConvertible
  • Swift.CustomPlaygroundDisplayConvertible
  • Swift.CustomReflectable
  • Swift.CustomStringConvertible
  • Swift.Decodable
  • Swift.Encodable
  • Swift.Equatable
  • Swift.Escapable
  • Swift.Hashable
  • Swift.Sendable
  • Swift.SendableMetatype
  • Swift.Strideable