FHIRDateFormatter
public class FHIRDateFormatter
                DateFormatter that should be used to parse FHIR  date strings into dates and vice versa
- 
                  
                  
Default initializer to create an instance of
FHIRDateFormatterDeclaration
Swift
public static let shared: FHIRDateFormatter - 
                  
                  
Creates a
Stringrepresentative of the passedDatethat is ideal to use for server communication since it used theISO8601DateFormatter.Declaration
Swift
public func string(from date: Date, format: DateFormats = .yearMonthDayTime) -> StringParameters
datethe
Datewhich will be converted into a date stringformatspecify how detailed the format should be. The format can be one of the FHIR dates
Return Value
a FHIR date string in the specified format
 - 
                  
                  
Creates a
Datefrom a string if it conforms to one of the FHIR date formatsYYYY, YYYY-MM, YYYY-MM-DD or YYYY-MM-DDThh:mm:ss+zz:zzhttps://www.hl7.org/fhir/datatypes.htmlThe method is idle to convert a date string from a server response since it used the
ISO8601DateFormatter.Declaration
Swift
public func date(from string: String, format: DateFormats? = nil) -> Date?Parameters
stringa date string in one of the valid date FHIR formats or the one
formatdefined explicitformatthe date
formatoff the string which should be used to evaluate the string. Passnilif the method should find the correct FHIR format.Return Value
a
Dateconstructed from thestringif the format was correct, otherwisenil - 
                  
                  
Creates a date string with the format
2020-06-23T09:41:00+00:00this format is currently used by the FHIR serverDeclaration
Swift
public func stringWithLongUTCTimeZone(from date: Date) -> StringParameters
datethe
Datewhich will be converted into a date stringReturn Value
a FHIR date string with a time zone
UTCin form+00:00 - 
                  
                  
Declaration
Swift
public enum DateFormats : CaseIterable 
            View on GitHub
          
      FHIRDateFormatter Class Reference