NSString TO NSDate Conversion
I Have a开发者_开发知识库 String.
NSString *str=@"January-06-2012";
How would I convert the above NSString like this.
@"2012-01-06 00:00:00 +0000";
Thanks
Use NSDateFormatter class .. YOu would need two of them .. one to convert your NSString* str to a date using [dateformatter dateFromString] and then another to convert your newly created date object to the differently formatted string using [dateformatter1 stringFromDate]
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSDateFormatter_Class/Reference/Reference.html
精彩评论