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];
You can change the AM and PM symbols on an NSDateFormatter as follows:
[dateFormatter setAMSymbol:@"am"];
[dateFormatter setPMSymbol:@"pm"];
or in Swift:
formatter.amSymbol = "am"
formatter.pmSymbol = "pm"
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]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With