-5
let startDate=NSDate().dateByAddingTimeInterval(-60*60*24)
let endDate=NSDate().dateByAddingTimeInterval(60*60*24*3)
lblStart.text = i.startDate
我想在标签中显示startdate。我如何将它转换为字符串。NSDate()转换为字符串
let startDate=NSDate().dateByAddingTimeInterval(-60*60*24)
let endDate=NSDate().dateByAddingTimeInterval(60*60*24*3)
lblStart.text = i.startDate
我想在标签中显示startdate。我如何将它转换为字符串。NSDate()转换为字符串
您可以尝试lblStart.text = "\(i.startDate)"
要将变量转换为字符串或得到其数值输出到标签上,你会做到这一点:"\(variable name)"
http://stackoverflow.com/questions/28332946/nsdateformatter -stringfromdatensdate-returns-empty-string –
http://www.appcoda.com/nsdate/ –
可能的重复[转换字符串到NSDate与Swift 2](http://stackoverflow.com/questions/33058091/convert-string -ns-nsdate-with-swift-2) – mgyky