iPhone + Twitter API: Converting time?

后端 未结 4 904
旧时难觅i
旧时难觅i 2020-12-30 09:14

Is there an easy way to convert the time stamp you get from twitter into unix time or minutes since now? I could parse through the string and convert everything myself but I

4条回答
  •  礼貌的吻别
    2020-12-30 10:07

    File a feature request with Apple and let them know you want this functionality on the iPhone. NSDateFormatter provides a legacy init method that takes a boolean flag indicating you want it to parse natural language, but it's only available on OS X. Wil Shipley wrote an interesting post a while back about this functionality in the context of heuristics and human factors.

    It doesn't seem likely that Apple will provide this functionality as this note would indicate from the NSDateFormatter docs:

    iPhone OS Note: iPhone OS supports only the 10.4+ behavior. 10.0-style methods and format strings are not available on iPhone OS.

    In other words, I think you'll have to parse it yourself.

提交回复
热议问题