Instant
public struct Instant: DateAndTime
An instant in time, known at least to the second and with a timezone, for machine times.
-
The date.
Declaration
Swift
public var date: FHIRDate
-
The time, including seconds.
Declaration
Swift
public var time: FHIRTime
-
The timezone.
Declaration
Swift
public var timeZone: TimeZone
-
An optional id of the element.
Declaration
Swift
public var id: String?
-
The parent/owner of the receiver, if any. Used to dereference resources.
Declaration
Swift
public weak var _owner: FHIRAbstractBase?
-
Optional extensions of the element.
Declaration
Swift
public var extension_fhir: [Extension]?
-
This very instant: an Instant instance representing current date and time.
Declaration
Swift
public static var now: Instant
-
Designated initializer.
Parameters
date
The date of the instant; ensures to have month and day (which are optional in the
FHIRDate
construct)time
The time of the instant; ensures to have seconds (which are optional in the
FHIRTime
construct)timeZone
The timezone
-
Uses
DateAndTimeParser
to initialize from a date-time string.Declaration
Swift
public init?(string: String)
Parameters
string
The string to parse the instant from
-
Declaration
Swift
public init(json: JSONType, owner: FHIRAbstractBase?, context: inout FHIRInstantiationContext)
Parameters
json
The value in its associated
JSONType
owner
Optional, the owning element
context
An in-out parameter for the instantiation context
-
Declaration
Swift
public func asJSON(errors: inout [FHIRValidationError]) -> JSONType
Parameters
errors
Errors encountered during serialization
Return Value
The FHIRJSON reperesentation of the receiver
-
Undocumented
Declaration
Swift
public struct Instant: DateAndTime
-
Declaration
Swift
public var description: String
-
Declaration
Swift
public static func ==(lhs: Instant, rhs: Instant) -> Bool
Parameters
lhs
A value to compare.
rhs
Another value to compare.
-
Declaration
Swift
public static func <(lhs: Instant, rhs: Instant) -> Bool
Parameters
lhs
A value to compare.
rhs
Another value to compare.
-
Attempts to parse an Instant from RFC1123-formatted date strings, usually used by HTTP headers:
EEE’,’ dd MMM yyyy HH’:‘mm’:‘ss z
EEEE’,’ dd’-'MMM’-'yy HH’:'mm’:'ss z
(RFC850)EEE MMM d HH’:'mm’:'ss yyyy
Created by taking liberally from Marcus Rohrmoser’s blogpost at http://blog.mro.name/2009/08/nsdateformatter-http-header/
Declaration
Swift
public static func fromHttpDate(_ httpDate: String) -> Instant?
Parameters
httpDate
The date string to parse
Return Value
An Instant if parsing was successful, nil otherwise