Convert string to date in Swift
How can I convert this string “2016-04-14T10:44:00+0000” into an NSDate and keep only the year, month, day, hour? The T in the middle of it really throws off what I am used to when working with dates. 18 Answers 18
How can I convert this string “2016-04-14T10:44:00+0000” into an NSDate and keep only the year, month, day, hour? The T in the middle of it really throws off what I am used to when working with dates. 18 Answers 18
How will I convert this datetime from the date? From this: 2016-02-29 12:24:26 to: Feb 29, 2016 So far, this is my code and it returns a nil value: let dateFormatter = NSDateFormatter() dateFormatter.dateFormat = “MM-dd-yyyy” dateFormatter.timeZone = NSTimeZone(name: “UTC”) let date: NSDate? = dateFormatter.dateFromString(“2016-02-29 12:24:26”) print(date) 23 Answers 23