美文网首页
将得到的String类型的日期转化为 年-月-日

将得到的String类型的日期转化为 年-月-日

作者: lalala1112389 | 来源:发表于2017-11-21 16:47 被阅读0次
 let commenttime = "\(dict["newsoccurrencetime"]!)"
        let timestampIntInMsec = Int.init(commenttime)
        let timestampDoubleInSec:Double = Double(timestampIntInMsec!)/1000
        print("timestampDoubleInSec=\(timestampDoubleInSec)")
        let parsedDate:NSDate = NSDate(timeIntervalSince1970: TimeInterval(timestampDoubleInSec))
        print("parsedDate=\(parsedDate)")
        let date = "\(parsedDate)".substring(to: 10)

相关文章

网友评论

      本文标题:将得到的String类型的日期转化为 年-月-日

      本文链接:https://www.haomeiwen.com/subject/dkpwvxtx.html