Issue with NSDateFormatter with date format in iOS 8

I have an NSDateFormatter that I am using to format the NSDate into a string. The following format does not work: ddMMyyyy_hhmmss_SSS. When I try to format the NSDate, I get the following output: 18092014_08: 49: 03,638, which has a colon and comma that I did not specify in the format. Please note that in iOS 7 I never had this issue. This is the code I am using:

NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat: @"ddMMyyyy_hhmmss_SSS"];
NSString *dateString = [dateFormat stringFromDate:exportDate];



source to share

2 answers

iOS8 have a serious problem with imo time format. I just solved a problem with my app (which I never had since iOS7) to go to settings -> general -> date time -> time format, switching it from 24 to 12 and then back to 24 and everything started working still time.

Try to follow my same procedure, it might work for you too!



I was having problems with NSDateFormatter

in iOS 8 and had to create a patch version for the app. You can read this. Basically you need to overwrite the default locale:

formatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"];


But it's best not to use it for the formats that you want to show the user. Hope this helps!



All Articles