Format string in Objective C

How can I format a string like "Fri Oct 17 00:00:00 +0200 2003" to a simple date string such as Fri Oct 17 2003?

Is there a simple solution?

+4
source share
2 answers

Yes, use NSDateFormatter to parse the first into NSDate, and then use another NSDateFormatter to write the NSDate to the second format.

+8
source

Here you can find a list of date format specifiers: Unicode date formats

+7
source

Source: https://habr.com/ru/post/1300907/