NSDateFormatter not showing full month name, only single digit number

ios, nsdate, nsdateformatter

Solution

Turns out to be an issue with the second line, `setLocale`. I assume that the system won't default to using english month names when the `locale` has been manually set? I live in an english speaking `locale`, but maybe it doesn't matter.

In any case, not setting the locale fixes the month name issue.

dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setTimeZone:[NSTimeZone localTimeZone]];    
[dateFormat setDateFormat:@"MMMM dd, h:mm a"];

Problem

Not sure what the issue is, but instead of getting a month name "July", I get "07". ``` dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setLocale:[NSLocale systemLocale]]; [dateFormat setTimeZone:[NSTimeZone localTimeZone]]; [dateFormat setDateFormat:@"MMMM dd, h:mm a"]; ``` I have tried M, MM, MMM, MMMM, and all of them give me a number, instead of the month name, though with different amounts of leading 0s.

Original source