-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