Why can't I correctly parse this date string with NSDateFormatter?

前端 未结 1 1786
野趣味
野趣味 2021-01-07 03:31

I\'m trying to parse a string that was generated by an NSDateFormatter using another NSDateFormatter with the same format.

Rather than trying to make that previous s

相关标签:
1条回答
  • 2021-01-07 04:03

    Your problem is that "YYYY" isn't a valid ICU date formatting option. You want "yyyy".

    Capital 'Y' is only valid when used with the "week of year" option (i.e. "'Week 'w' of 'Y").

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