iOS: dateformatter in swift return nil -


i have code in app

service.requestlastdate{ (response) -> () in          var str = response nsstring              var d = str.stringbyreplacingoccurrencesofstring("\"", withstring: "")              println("d \(str)") // d 2015-05-25 08:13:33              var dateformatter = nsdateformatter()             dateformatter.dateformat = "yyyy-mm-dd hh:mm"              var date_formatted = dateformatter.datefromstring(d)              println("date formatted \(date_formatted)") // nil 

with code date_formatted ever nil. if print in consolle "d" result "2015-02-12 08:15:16", string real string. if try use string "example" correct date_formatted. happen? can't understand. tried changing nslocale , timezone dateformatter have ever same result.

this request

func requestlastdate(completion:(response:nsstring)->()){          my_req_date = request(.get, "http://example.com/current_date")             .responsestring { (_, _, string, error) in              println(" server \(string!)") //server "2015-05-25 08:13:33"             completion(response: string!)          }     } 

hate break :)

think might be:

"yyyy-mm-dd hh:mm:ss" 

not

"yyyy-mm-dd hh:mm" 

?


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -