NSDateFormatter returns nil

前端 未结 2 1626
星月不相逢
星月不相逢 2021-01-16 10:42

I\'m trying to parse a date passed in the format:

\"2014-03-26T05:07:42.14286Z\"

My NSDateFormatter code looks like this

2条回答
  •  情歌与酒
    2021-01-16 11:11

    Just replace the below line to modified line

    [dateFormatter setDateFormat:@"yyyy'-'MM'-'dd'T'HH':'mm':'SS'Z'"];
    

    Modified line:-

    [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZ"];
    

提交回复
热议问题