I need to get the current time in a 24 hour format to compare to other nsdate objects I created from a string. In thid case I dont have a string time so i tried created one but I cant get it to work. This is my code:
let now = NSDate()
let dateFormatter = NSDateFormatter()
dateFormatter.timeZone = NSTimeZone.localTimeZone()
dateFormatter.dateFormat = "MM-dd-yyyy HH:mm"
let calendar = NSCalendar.currentCalendar()
let dateString = NSDateFormatter.localizedStringFromDate(now, dateStyle: .ShortStyle, timeStyle: .ShortStyle)
let currentTime = dateFormatter.dateFromString(dateString)
print(currentTime)
current time is nil, any help is appreciated.