LastCommunicationDate is a string, but you are converting it to a Double. Try this instead: let lastCommunicationDate = “2022-01-21T10:58:21.367” //Create dateformatter to convert string to Date let isoDateFormatter = ISO8601DateFormatter() isoDateFormatter.formatOptions = [ .withFullDate, .withTime, .withColonSeparatorInTime, .withFractionalSeconds ] let isoDateFormatter2 = ISO8601DateFormatter() isoDateFormatter2.formatOptions = [ .withFullDate, .withTime, .withColonSeparatorInTime ] let date = isoDateFormatter.date(from: lastCommunicationDate) ?? … Read more