this one is killing me, I have the following date format:
+ (NSDateFormatter *)dateFormatter {
static NSDateFormatter *_dateFormatter = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
NSString *format = [NSDateFormatter dateFormatFromTemplate:@"hh:mm a" options:0 locale:[NSLocale currentLocale]];
_dateFormatter = [[NSDateFormatter alloc] init];
[_dateFormatter setDateFormat:format];
});
return _dateFormatter;
}
I want the final hour format to match the settings of the user clock, so if the user uses "24-hour time", the result should be, for example:
19:41
Otherwise, the result should be
7:41 PM
ok now for the kill me part, this seems to work fine if I set the Region Format phone to United States.
If I turn the 24-hour time on / off, the date does change from 19:41to7:41 PM
, " " - , " ", "", 7:41 PM , / "24- ".
, :
@"HH:mm a" (changed hh to uppercase HH)
"" "24- ", "United State" 24- , , !
?!
, , dateFormatFromTemplate .