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!)
这是什么错了。
谢谢尼拉夫我可以打印价值 –