That should do the trick:
let date = NSDate()
let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd"
let timeFormatter = NSDateFormatter()
timeFormatter.dateFormat = "HH:mm:ss.S"
println(dateFormatter.stringFromDate(date))
println(timeFormatter.stringFromDate(date))
2
solved swift date and time ios [closed]