I try to convert the Date to a string and then trim it. Somehow Xcode doesnt accept beforeConv
as a String. I am clueless, also tried other methods to convert the date to a string, like formatter.sring(from: date)
which did not work.
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd HH:mm:ss Z"
let date = Date()
let beforeConv = "\(date)"
let start = beforeConv(beforeConv.startIndex, offsetBy: 11) // Cannot call value of non-function type 'String'
let end = beforeConv(beforeConv.endIndex, offsetBy: -12) // Cannot call value of non-function type 'String'
let range = start..<end
let cleanTime = beforeConv[range]
let postZone = String(cleanTime)