We archive our database files and use the following code to name them. We've been using the same code for about 3 years without any issues but today I have one user that is exhibiting very strange results. I'm assuming I'm missing something very basic, simple, but I'm just not seeing it.
Here is the code: //rename our sqlite file //basically, we tack on a date & time to the current file name NSString *fileExtension = [[self coreDataStorePath] pathExtension]; NSDateFormatter *fileArchiveDateFormat = [[NSDateFormatter alloc] init]; [fileArchiveDateFormat setDateFormat: @"yyyyMMdd_HHmmss"]; NSString *newPath = [[[[self coreDataStorePath] stringByDeletingPathExtension] stringByAppendingString: [fileArchiveDateFormat stringFromDate:[NSDate date]]] stringByAppendingPathExtension: fileExtension]; [fileArchiveDateFormat release]; It should result in a filename like this: "pim20120801_011922.informantdata", and for every other customer I've ever seen it does. For this one user it gives me: "pim20120801_011922 PM_.informantdata", I don't know where the extra _ is coming from, or where the AM/PM indicator is coming from. This is the only place in our code where we name these files as my first thought was I had some rogue code somewhere. I've also double checked the Apple docs on date formats and pretty sure what we have there is correct. The [self coreDataStorePath] returns "pim.informantdata", so that is the what string its starting from (with the /Documents path of course). Again, I'm pretty certain something simple will help me here - perhaps I need to [fileArchiveDateFormat setLocale: [[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"] autorelease]]; ? I've also considered adding [fileArchiveDateFormat setFormatterBehavior:NSDateFormatterBehavior10_4]; I could try it and not bother you fine folk - but this is iOS where I can't just give the user a build to test for me. I kind of have to "know" and of course it all works fine for me. I suppose the two things above are at the least safe to add.. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com