I want to separate my String dateTime to different variables date and time because I will display it separately. How could I do this?
Here's my code in getting the date only and it returns nil:
let datetime = "2015-04-06T13:24:11.913"
var dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "MMM-DD-YYYY"
let date = dateFormatter.dateFromString(datetime)
println(date)
Thanks in advance.
Update:
This is my error,
Update 2: It doesn't return an error but it gives me the wrong Month for the formatted date