November icon indicating copy to clipboard operation
November copied to clipboard

"yyyy-MM-dd HH:mm:ss Z"

Open ghost opened this issue 9 years ago • 5 comments

does the pod support "yyyy-MM-dd HH:mm:ss Z" or do i have to converted it and use the pod

ghost avatar Jan 28 '17 17:01 ghost

I don't know why you should have any problem with this format.

ManueGE avatar Jan 28 '17 17:01 ManueGE

I must be doing something wrong.

this return nil let dates = "2017-01-27 19:07:25 +0000" print(Date(string: dates, format: .fullDate))

ghost avatar Jan 28 '17 17:01 ghost

Strange, it should just work.

The library doesn't do nothing but caching and reusing DateFormatter instances. Can you try it with a plain DateFormatter and see if it works? maybe you are defining the format wrong.

ManueGE avatar Jan 28 '17 18:01 ManueGE

this way work. :( other way would of been quicker but i will just use an extension

    let date = "2017-01-27 19:07:25 +0000"
    let formatter = DateFormatter()
    formatter.dateFormat = "yyyy-MM-dd HH:mm:ss Z"
    let datefrom = formatter.date(from: date)
    let convertedDate = datefrom.string(dateStyle: .short, timeStyle: .none)

ghost avatar Jan 28 '17 18:01 ghost

Can I see how you declare .fullDate ??

ManueGE avatar Jan 30 '17 08:01 ManueGE