开发者

iPhone : How to convert date?

开发者 https://www.devze.com 2023-03-22 04:45 出处:网络
My date is coming 开发者_如何转开发in string formatfrom server Output of date come like this \"07/30/2011\",

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

精彩评论

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