iphone NSDate Conversion problem

后端 未结 2 1104
执念已碎
执念已碎 2021-02-06 16:47

In my graph Api for facebook..

I am getting this data.. from Json..
\"updated_time\" = \"2011-05-17T14:52:16+0000\";

and I am using this code to

相关标签:
2条回答
  • 2021-02-06 17:18

    The dateFormat was wrong, it should be with capital Ms for the month:

    [df setDateFormat:@"yyyy-MM-ddTHH:mm:ssZZZZ"];
    
    0 讨论(0)
  • 2021-02-06 17:31

    It looks like your date format string isn't taking the letter "T" into account – and you should probably be enclosing literal text between apostrophes, just to be safe. Try:

    [df setDateFormat:@"yyyy'-'MM'-'dd'T'HH':'mm':'ssZZZZ"];

    0 讨论(0)
提交回复
热议问题