ZonedDateTime
public struct ZonedDateTime
Undocumented
-
The minimum supported ZonedDateTime from the system clock in the default time-zone, ‘-999999999-01-01T00:00:00’.
Declaration
Swift
public static var min: ZonedDateTime { get }
-
The maximum supported ZonedDateTime from the system clock in the default time-zone, ‘+999999999-12-31T23:59:59.999999999’.
Declaration
Swift
public static var max: ZonedDateTime { get }
-
Obtains an instance of ZonedDateTime from a text string such as ‘2007-12-03T10:15:30.217Z’.
If the input text and date format are mismatched, returns nil.
Declaration
Parameters
text
The text to parse.
clock
The Clock instance.
Return Value
The parsed zoned date-time.
-
Obtains an instance of ZonedDateTime from a text string such as ‘2007-12-03T10:15:30.217Z’.
If the input text and date format are mismatched, returns nil.
Declaration
Swift
public static func parse(_ text: String, timeZone: TimeZone) -> ZonedDateTime?
Parameters
text
The text to parse.
timeZone
The TimeZone instance.
Return Value
The parsed zoned date-time.
-
Obtains an instance of ZonedDateTime from a text string using a specific formatter.
If the input text and date format are mismatched, returns nil.
Declaration
Parameters
text
The text to parse.
formatter
The formatter to parse.
clock
The Clock instance.
Return Value
The parsed zoned date-time.
-
Obtains an instance of ZonedDateTime from a text string using a specific formatter.
If the input text and date format are mismatched, returns nil.
Declaration
Swift
public static func parse(_ text: String, formatter: DateFormatter, timeZone: TimeZone) -> ZonedDateTime?
Parameters
text
The text to parse.
formatter
The formatter to parse.
timeZone
The TimeZone instance.
Return Value
The parsed zoned date-time.
-
Gets the Clock part of this date-time.
Declaration
Swift
public var clock: Clock { get }
-
Gets the TimeZone part of this date-time.
Declaration
Swift
public var timeZone: TimeZone { get }
-
Gets the LocalDateTime part of this date-time.
Declaration
Swift
public fileprivate(set) var localDateTime: LocalDateTime { get set }
-
Gets the LocalDate part of this date-time.
Declaration
Swift
public var localDate: LocalDate { get }
-
Gets the LocalTime part of this date-time.
Declaration
Swift
public var localTime: LocalTime { get }
-
Gets the year field.
Declaration
Swift
public var year: Int { get set }
-
Gets the month-of-year field from 1 to 12.
Declaration
Swift
public var month: Int { get set }
-
Gets the day-of-month field.
Declaration
Swift
public var day: Int { get set }
-
Gets the day-of-week field.
Declaration
Swift
public var dayOfWeek: Int { get }
-
Gets the hour-of-day field.
Declaration
Swift
public var hour: Int { get set }
-
Gets the minute-of-hour field.
Declaration
Swift
public var minute: Int { get set }
-
Gets the second-of-minute field.
Declaration
Swift
public var second: Int { get set }
-
Gets the nano-of-second field.
Declaration
Swift
public var nano: Int { get set }
-
Returns the length of the month represented by this date.
Declaration
Swift
public func lengthOfMonth() -> Int
-
Returns the length of the year represented by this date.
Declaration
Swift
public func lengthOfYear() -> Int
-
Checks if the year is a leap year, according to the ISO proleptic calendar system rules.
Declaration
Swift
public func isLeapYear() -> Bool
-
Returns an instance of Date.
Declaration
Swift
public func toDate(clock: Clock?) -> Date
-
Returns an instance of Date.
Declaration
Swift
public func toDate(timeZone: TimeZone? = nil) -> Date
-
Returns a copy of this date-time with a different time-zone, retaining the local date-time if possible.
Declaration
Swift
public func with(zoneSameLocal clock: Clock) -> ZonedDateTime
Return Value
A ZonedDateTime based on this date-time with the requested zone.
-
Returns a copy of this date-time with a different time-zone, retaining the local date-time if possible.
Declaration
Swift
public func with(zoneSameLocal timeZone: TimeZone) -> ZonedDateTime
Return Value
A ZonedDateTime based on this date-time with the requested zone.
-
Returns a copy of this date-time with a different time-zone, retaining the instant.
Declaration
Swift
public func with(zoneSameInstant clock: Clock) -> ZonedDateTime
Return Value
A ZonedDateTime based on this date-time with the requested zone.
-
Returns a copy of this date-time with a different time-zone, retaining the instant.
Declaration
Swift
public func with(zoneSameInstant timeZone: TimeZone) -> ZonedDateTime
Return Value
A ZonedDateTime based on this date-time with the requested zone.
-
Returns a copy of this ZonedDateTime with the year value altered.
Declaration
Swift
public func with(year: Int) -> ZonedDateTime
Return Value
An ZonedDateTime based on this with the specified field set.
-
Returns a copy of this ZonedDateTime with the month-of-year value altered.
Declaration
Swift
public func with(month: Int) -> ZonedDateTime
Return Value
An ZonedDateTime based on this with the specified field set.
-
Returns a copy of this ZonedDateTime with the day-of-month value altered.
Declaration
Swift
public func with(day: Int) -> ZonedDateTime
Return Value
An ZonedDateTime based on this with the specified field set.
-
Returns a copy of this ZonedDateTime with the hour-of-day value altered.
Declaration
Swift
public func with(hour: Int) -> ZonedDateTime
Return Value
An ZonedDateTime based on this with the specified field set.
-
Returns a copy of this ZonedDateTime with the minute-of-hour value altered.
Declaration
Swift
public func with(minute: Int) -> ZonedDateTime
Return Value
An ZonedDateTime based on this with the specified field set.
-
Returns a copy of this ZonedDateTime with the second-of-minute value altered.
Declaration
Swift
public func with(second: Int) -> ZonedDateTime
Return Value
An ZonedDateTime based on this with the specified field set.
-
Returns a copy of this ZonedDateTime with the nano-of-second value altered.
Declaration
Swift
public func with(nano: Int) -> ZonedDateTime
Return Value
An ZonedDateTime based on this with the specified field set.
-
Returns a copy of this ZonedDateTime with the specified amount added.
- Results: An ZonedDateTime based on this date-time with the specified amount added.
Declaration
Swift
public func plus(component: LocalDateTime.PlusComponent, newValue: Int) -> ZonedDateTime
Parameters
component
The unit of the amount to add.
newValue
The amount of the unit to add to the result.
-
Returns a copy of this ZonedDateTime with the specified period in years added.
- Results: An ZonedDateTime based on this date-time with the specified amount added.
Declaration
Swift
public func plus(year: Int) -> ZonedDateTime
-
Returns a copy of this ZonedDateTime with the specified period in months added.
- Results: An ZonedDateTime based on this date-time with the specified amount added.
Declaration
Swift
public func plus(month: Int) -> ZonedDateTime
-
Returns a copy of this ZonedDateTime with the specified period in weeks added.
- Results: An ZonedDateTime based on this date-time with the specified amount added.
Declaration
Swift
public func plus(week: Int) -> ZonedDateTime
-
Returns a copy of this ZonedDateTime with the specified period in days added.
- Results: An ZonedDateTime based on this date-time with the specified amount added.
Declaration
Swift
public func plus(day: Int) -> ZonedDateTime
-
Returns a copy of this ZonedDateTime with the specified period in hours added.
- Results: An ZonedDateTime based on this date-time with the specified amount added.
Declaration
Swift
public func plus(hour: Int) -> ZonedDateTime
-
Returns a copy of this ZonedDateTime with the specified period in minutes added.
- Results: An ZonedDateTime based on this date-time with the specified amount added.
Declaration
Swift
public func plus(minute: Int) -> ZonedDateTime
-
Returns a copy of this ZonedDateTime with the specified period in seconds added.
- Results: An ZonedDateTime based on this date-time with the specified amount added.
Declaration
Swift
public func plus(second: Int) -> ZonedDateTime
-
Returns a copy of this ZonedDateTime with the specified period in nanoseconds added.
- Results: An ZonedDateTime based on this date-time with the specified amount added.
Declaration
Swift
public func plus(nano: Int) -> ZonedDateTime
-
Returns a copy of this ZonedDateTime with the specified amount subtracted.
- Results: An ZonedDateTime based on this date-time with the specified amount subtracted.
Declaration
Swift
public func minus(component: LocalDateTime.PlusComponent, newValue: Int) -> ZonedDateTime
Parameters
component
The unit of the amount to subtract.
newValue
The amount of the unit to subtract to the result.
-
Returns a copy of this ZonedDateTime with the specified period in years subtracted.
- Results: An ZonedDateTime based on this date-time with the specified amount subtracted.
Declaration
Swift
public func minus(year: Int) -> ZonedDateTime
-
Returns a copy of this ZonedDateTime with the specified period in months subtracted.
- Results: An ZonedDateTime based on this date-time with the specified amount subtracted.
Declaration
Swift
public func minus(month: Int) -> ZonedDateTime
-
Returns a copy of this ZonedDateTime with the specified period in weeks subtracted.
- Results: An ZonedDateTime based on this date-time with the specified amount subtracted.
Declaration
Swift
public func minus(week: Int) -> ZonedDateTime
-
Returns a copy of this ZonedDateTime with the specified period in days subtracted.
- Results: An ZonedDateTime based on this date-time with the specified amount subtracted.
Declaration
Swift
public func minus(day: Int) -> ZonedDateTime
-
Returns a copy of this ZonedDateTime with the specified period in hours subtracted.
- Results: An ZonedDateTime based on this date-time with the specified amount subtracted.
Declaration
Swift
public func minus(hour: Int) -> ZonedDateTime
-
Returns a copy of this ZonedDateTime with the specified period in minutes subtracted.
- Results: An ZonedDateTime based on this date-time with the specified amount subtracted.
Declaration
Swift
public func minus(minute: Int) -> ZonedDateTime
-
Returns a copy of this ZonedDateTime with the specified period in seconds subtracted.
- Results: An ZonedDateTime based on this date-time with the specified amount subtracted.
Declaration
Swift
public func minus(second: Int) -> ZonedDateTime
-
Returns a copy of this ZonedDateTime with the specified period in nanoseconds subtracted.
- Results: An ZonedDateTime based on this date-time with the specified amount subtracted.
Declaration
Swift
public func minus(nano: Int) -> ZonedDateTime
-
Gets the range of valid values for the specified field.
Declaration
Swift
public func range(_ component: LocalDateTime.RangeComponent) -> (Int, Int)
Return Value
The range of valid values for the field.
-
Calculates the period between this ZonedDateTime and another ZonedDateTime as a Period.
Declaration
Swift
public func until(endDateTime: ZonedDateTime) -> Period
Parameters
endDateTime
The end date-time, exclusive, which is converted to an ZonedDateTime.
Return Value
The Period of time between this date-time and the end date-time.
-
Calculates the amount of time until another ZonedDateTime in terms of the specified unit.
Declaration
Swift
public func until(endDateTime: ZonedDateTime, component: LocalDateTime.UntilComponent) -> Int64
Parameters
endDateTime
The end date-time, exclusive, which is converted to an ZonedDateTime.
component
The unit to measure the amount in.
Return Value
The amount of time between this date-time and the end date-time.
-
Formats this time using the specified formatter.
Declaration
Swift
public func format(_ formatter: DateFormatter) -> String
Return Value
The formatted date string.
-
ZonedDateTime
Declaration
Swift
public static func + (lhs: ZonedDateTime, rhs: ZonedDateTime) -> ZonedDateTime
-
Undocumented
Declaration
Swift
public static func += (lhs: inout ZonedDateTime, rhs: ZonedDateTime)
-
Undocumented
Declaration
Swift
public static func - (lhs: ZonedDateTime, rhs: ZonedDateTime) -> ZonedDateTime
-
Undocumented
Declaration
Swift
public static func -= (lhs: inout ZonedDateTime, rhs: ZonedDateTime)
-
LocalDateTime
Declaration
Swift
public static func + (lhs: ZonedDateTime, rhs: LocalDateTime) -> ZonedDateTime
-
Undocumented
Declaration
Swift
public static func += (lhs: inout ZonedDateTime, rhs: LocalDateTime)
-
Undocumented
Declaration
Swift
public static func - (lhs: ZonedDateTime, rhs: LocalDateTime) -> ZonedDateTime
-
Undocumented
Declaration
Swift
public static func -= (lhs: inout ZonedDateTime, rhs: LocalDateTime)
-
LocalDate
Declaration
Swift
public static func + (lhs: ZonedDateTime, rhs: LocalDate) -> ZonedDateTime
-
Undocumented
Declaration
Swift
public static func += (lhs: inout ZonedDateTime, rhs: LocalDate)
-
Undocumented
Declaration
Swift
public static func - (lhs: ZonedDateTime, rhs: LocalDate) -> ZonedDateTime
-
Undocumented
Declaration
Swift
public static func -= (lhs: inout ZonedDateTime, rhs: LocalDate)
-
LocalTime
Declaration
Swift
public static func + (lhs: ZonedDateTime, rhs: LocalTime) -> ZonedDateTime
-
Undocumented
Declaration
Swift
public static func += (lhs: inout ZonedDateTime, rhs: LocalTime)
-
Undocumented
Declaration
Swift
public static func - (lhs: ZonedDateTime, rhs: LocalTime) -> ZonedDateTime
-
Undocumented
Declaration
Swift
public static func -= (lhs: inout ZonedDateTime, rhs: LocalTime)
-
Creates the current date-time from the time-zone.
Declaration
Swift
public init(timeZone: TimeZone)
-
Creates a ZonedDateTime from an instance of Date.
Declaration
Swift
public init(_ date: Date, timeZone: TimeZone)
-
Copies an instance of ZonedDateTime.
Declaration
Swift
public init(_ dateTime: ZonedDateTime)
-
Creates an instance of ZonedDateTime from an instance of LocalDateTime.
Declaration
Swift
public init(_ dateTime: LocalDateTime, clock: Clock = Clock.current)
-
Creates an instance of ZonedDateTime from an instance of LocalDateTime.
Declaration
Swift
public init(_ dateTime: LocalDateTime, timeZone: TimeZone)
-
Creates an instance of ZonedDateTime from year, month, day, hour, minute, second and nanosecond.
Declaration
Swift
public init(year: Int, month: Int, day: Int, hour: Int, minute: Int, second: Int, nanoOfSecond: Int, timeZone: TimeZone)
-
Creates an instance of ZonedDateTime using seconds from the epoch of 1970-01-01T00:00:00Z.
Declaration
Swift
public init(epochDay: Int64, nanoOfDay: Int64, timeZone: TimeZone)
-
Returns a Boolean value indicating whether the value of the first argument is less than that of the second argument.
Declaration
Swift
public static func < (lhs: ZonedDateTime, rhs: ZonedDateTime) -> Bool
-
Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.
Declaration
Swift
public static func > (lhs: ZonedDateTime, rhs: ZonedDateTime) -> Bool
-
Returns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.
Declaration
Swift
public static func <= (lhs: ZonedDateTime, rhs: ZonedDateTime) -> Bool
-
Returns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.
Declaration
Swift
public static func >= (lhs: ZonedDateTime, rhs: ZonedDateTime) -> Bool
-
The hash value.
Hash values are not guaranteed to be equal across different executions of your program. Do not save hash values to use during a future execution.
Declaration
Swift
public var hashValue: Int { get }
-
Returns a Boolean value indicating whether two values are equal.
Declaration
Swift
public static func == (lhs: ZonedDateTime, rhs: ZonedDateTime) -> Bool
-
A textual representation of this instance.
Declaration
Swift
public var description: String { get }
-
A textual representation of this instance, suitable for debugging.
Declaration
Swift
public var debugDescription: String { get }
-
The custom mirror for this instance.
If this type has value semantics, the mirror should be unaffected by subsequent mutations of the instance.
Declaration
Swift
public var customMirror: Mirror { get }
-
Returns the custom playground description for this instance.
If this type has value semantics, the instance returned should be unaffected by subsequent mutations if possible.
Declaration
Swift
public var playgroundDescription: Any { get }
-
Creates a new instance by decoding from the given decoder.
This initializer throws an error if reading from the decoder fails, or if the data read is corrupted or otherwise invalid.
Declaration
Swift
public init(from decoder: Decoder) throws
Parameters
decoder
The decoder to read data from.
-
Encodes this value into the given encoder.
If the value fails to encode anything,
encoder
will encode an empty keyed container in its place.This function throws an error if any values are invalid for the given encoder’s format.
Declaration
Swift
public func encode(to encoder: Encoder) throws
Parameters
encoder
The encoder to write data to.