NSDateFormatter issue (bug maybe)?
NSDateFormatter issue (bug maybe)?
- Subject: NSDateFormatter issue (bug maybe)?
- From: James Gillespie <email@hidden>
- Date: Sat, 18 Jul 2009 13:03:10 -0700
Hi All,
Thanks in advance for any help on this issue. I have a file that uses
the following format for date and times:
(4 digit year)-(2 digit month)-(2 digit day)T(2 digit hour, 0-23):(2
digit minute):(2 digit seconds)-(4 digit offset from GMT)
Example: 2009-07-17T17:12:20-0700
I am using an NSDateFormatter with a custom date format to read these
dates.
formatter = [[NSDateFormatter alloc] init];
[formatter setFormatterBehavior:NSDateFormatterBehavior10_4];
[formatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZ"];
On the Mac this works great for any combination of Region setting and
24hr/AM,PM settings. On the iPhone (both iPhone OS 2.2.1 and 3.0)
this does not work if the Region setting is set to something that
defaults to 24hr time (like UK, France, and Thai) but the time display
setting is set by the user to AM/PM. For example: on the iPhone if
in "Settings" you set the region to UK and turn 24-Hour Time off.
When the phone is configured like this the above code wants to read
and write dates with the following format.
(4 digit year)-(2 digit month)-(2 digit day)T(2 digit hour, 0-23):(2
digit minute):(2 digit seconds) (AM/PM)-(4 digit offset from GMT)
Example: 2009-07-17T17:12:20 PM-0700
This is not the behavior I would have expected. Am I configuring
NSDateFormatter correctly? Is this a bug I should file in Radar?
Again any help is greatly appreciated. We have an app in the App
Store with this issue and it is causing some customers issues.
Thanks,
James
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden