开发者

iPhone : How to convert date?

My date is coming 开发者_如何转开发in string format from server

Output of date come like this "07/30/2011",

I want a date format "30 july"

how can i do that?


Easy, use NSDateFormatter

Example,

NSDateFormatter *dateFormatter=[[NSDateFormatter alloc]init];
[dateFormatter setDateFormat:@"MM/dd/yyyy"];
NSDate *date = [dateFormatter dateFromString:@"07/30/2011" ];
[dateFormatter setDateFormat:@"dd MMM"];
NSString *output = [dateFormatter stringFromDate:date];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜