I am getting date in string formate ad “2012-04-11T07:51:10+0000” & I want to convert it to NSDate as “11-04-2012”. I dont understand how to use “setDateFormat” for this.
This is what I am doing–
[dateFormatter setDateFormat:@”yyyy’-‘MM’-‘dd’T’HH’:’mm’:’ss’+’zzzz”];
Please help.
And whatever NSDate I will get I again want to convert to string ie. only 11-04-2012.
I have searched on ggl. But no satisfactory result 🙁
please help.
Here is how to parse the string to generate a date:
Now you can generate a new string representation of the date as follows:
The problem with the
dateFormatyou were using is that you don’t have to escape all the symbols such as'MM'and thatzzzzis not the correct symbol to parse the timezone of type+0000.Have a look at this documentation for more information.