Parsing a RFC 822 date with NSDateFormatter

后端 未结 4 668
逝去的感伤
逝去的感伤 2021-01-04 03:01

I\'m using a NSDateFormatter to parse a RFC 822 date on the iPhone. However, there is no way to specify optional elements in the date format. There are a couple of optional

4条回答
  •  生来不讨喜
    2021-01-04 03:06

    Count the number of salient characters before deciding which formatter to use. For example, the two you give have different numbers of commas and spaces. If no known format matches the counts, then you known not even to try parsing it as a date.

提交回复
热议问题