ios - MagicalRecord date parsing -


i've got date in following format:

2013-05-04t05:07:09+00:00

i'm using magicalrecord map nsdate automatically. far can see above date format should comply magicalrecord's default date format: yyyy-mm-dd't'hh:mm:ss'z'.

i have tried custom dateformat entry in attribute's user info (see this article):

yyyy-mm-ddthh:mm:ss+z, yyyy-mm-dd t hh:mm:ss z, yyyy-mm-dd't'hh:mm:ss'+'z

but none of them work in order have parse date , returns nil regardless of setting custom dateformat or using magicalrecord's default format.

let's @ string:

2013-05-04t05:07:09+00:00 

this is:

  1. four digit year
  2. hyphen
  3. zero-padded month
  4. hyphen
  5. zero-padded day of month
  6. 't' character
  7. zero-padded hour
  8. ':' character
  9. zero-padded minute
  10. ':' character
  11. zero-padded second
  12. timezone (with direction gmt , separating colon)

thus, according the date format specifiers documentation, pattern you'd want is:

yyyy-mm-dd't'hh:mm:sszzzzz 

also, sure use en_us_posix locale nsdateformatter.


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -