-3

I have this date that I'm getting from XML,

2009-11-05T02:15:03.000Z

How would I change it to

11 May 2009

I found a way to remove the .000Z so I only have this left

2009-11-05T02:15:03

Any help is greatly appreciated

IamGretar
  • 71
  • 9
  • 2
    Google `NSDateFormatter`. –  Jun 27 '13 at 18:51
  • 3
    And read the [excellent Apple documentation](https://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSDateFormatter_Class/Reference/Reference.html). Along with the documentation for [date format strings](https://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/DataFormatting/Articles/dfDateFormatting10_4.html#//apple_ref/doc/uid/TP40002369-SW1). Please try to avoid asking the same questions that others ask here daily, rather than reading and understanding the docs. – Hot Licks Jun 27 '13 at 18:54
  • And understand that to do the above conversion you'd need to set a date formatter with the first format, convert from string to NSDate, then set a date formatter with the second format and convert back from NSDate to string. Two different formats. – Hot Licks Jun 27 '13 at 18:56

1 Answers1

0

The "proper" way would be to parse the original string to a date using an NSDateFormatter configured with the format used to generate the date in XML, then use a second NSDateFormatter with the format style you want to use to format the parsed date.

JAB
  • 20,783
  • 6
  • 71
  • 80