如何从字符串返回预定义时区的NSDate
let responseString = "2015-8-17 GMT+05:30" var dFormatter = NSDateFormatter() dFormatter.dateFormat = "yyyy-M-dd ZZZZ" var serverTime = dFormatter.dateFromString(responseString) println("NSDate : \(serverTime!)")
上面的代码返回时间为
2015-08-16 18:30:00 +0000