let dateFormater : DateFormatter = DateFormatter()
dateFormater.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ"
let date = dateFormater.date(from: "2016-11-11T11:42:27Z")
print("date is ---->%@",date)
let timestamp = date?.timeIntervalSince1970
print("timestamp is ---->%@",timestamp!)
let str = String(format: "%@",timestamp!)
print("str value is ---->%@",str)
date is -----> 2016-11-11 11:42:27 +000
timestamp is----->1478864547.0
str value is-----> null
獲取日期和時間戳記值。如何將timestamp
值更改爲字符串。意思是1478864547.0
(timestampvalue)字符串合成時間戳不以字符串格式更改
let str = String(format: "%@",timestamp!)
這是什麼錯了。
謝謝尼拉夫我可以打印價值 –