I want to convert date 2012-12-26
to december 26, 2012
in iOS?
I am using websrvice and the data comes in this format 1990-12-26
.
I want to change this to december 26, 2012
format.
This is what I am doing:
lbl_Rightside.text = [rootElement stringValueForNode:@"date"];
NSLog(@"lbl_Rightside is %@",lbl_Rightside.text);
[lbl_Rightside release];
Getting date to this label on 1990-12-26
. Now I want to change date to december 26, 2012
format.
Any hints from experts would be very welcome.
Try to look at NSDateFormatter Class,
The format you are looking for is something like:
you can use NSDateFormatter to do this kind of things. First
Different format strings can be found here.
by using
NSDateFormatter
NSString to NSDate
NSDate convert to NSString:
Check the official Apple documentation about NSDateFormatter. You should use this class to do this kind of formatting.