Date Format in Swift

You have to declare 2 different NSDateFormatters, the first to convert the string to a NSDate and the second to print the date in your format.Try this code: Swift 3 and higher: From Swift 3 NSDate class has been changed to Date and NSDateFormatter to DateFormatter.