我如何从日期转换此日期时间?
由此:2016-02-29 12:24:26发布
于:2016年2月29日
到目前为止,这是我的代码,它返回一个nil值:
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)
Run Code Online (Sandbox Code Playgroud)