views:

385

answers:

1

How can I set the AM / PM time style to lowercase? I'm using the following code and according to Apple's documentation this should returned these values as lowercase but it doesn't.

[_detailsTimeFormatter setTimeStyle:NSDateFormatterShortStyle];
+1  A: 

I am not sure why Apple's examples show the AM / PM in lower case, but it is easy to make the date string lower case:

NSDateFormatter *detailsTimeFormatter = [[NSDateFormatter alloc] init];
[detailsTimeFormatter setTimeStyle:NSDateFormatterShortStyle];
NSLog(@"%@",[[detailsTimeFormatter stringFromDate:[NSDate date]] lowercaseString]);
gerry3
Thank you it worked perfectly. It's strange the documentation shows the wrong output. I've also discovered in 12hr mode there is a leading zero before the hour, 01:49pm. Annoyingly I haven't figured out how to remove it. It seems to relate to the device system settings because the clock at the top is the same and it's not there on the simulator.
Jim