I'm pretty new to objective-c and I have a date stored in a sqlite table as an integer e.g. 20131017 (which represents Oct 17, 2013). I want to display this to the user in the format Oct 17, 2013 but my code produces a null when I log it.
No doubt something very fundamental I'm missing - but for the life of me I can't see it.
Here's the code:
_fromDate.text = _startDate; //e.g.20131017 (representing Oct 17, 2013)
NSString *dateString =[NSString stringWithFormat:@"%d", [_fromDate.text intValue]];
NSLog(@"dateString: %@", dateString);// shows 20131017 ok
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"MMM dd, yyyy"];
NSDate *date = [dateFormat dateFromString:dateString];
NSLog(@"date: %@", date); //produces a nil result
Appreciate any help. Thx.