Use this one
NSString *dateStr=@"2012-07-13 00:00:00.0";
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"yyyy-MM-dd HH:mm:ss.S"];
NSDate *date = [df dateFromString: dateStr];
[df setDateFormat:@"MM/dd/yyyy"];
NSString *convertedString = [df stringFromDate:date];
NSLog(@"Your String : %@",convertedString);
Output:
Your String : 07/13/2012
6
solved Converting Date to proper format when the Value obtained from the Db is in format 2012-07-13 00:00:00.0 [duplicate]