I need the time from my uiDatePicker to be in 24hr format, I understand you can't force this mode if the device is set to display AM/PM? If thats the case, how can I detect the device is in 24hr mode (or not) so I can add 12 to my PM times? Many thanks for any help...
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Wel you can, you need to set the local:
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss Z"];
NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"NL"];
NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@"UTC"];
[formatter setTimeZone:timeZone];
[formatter setLocale:locale];
[locale release], locale = nil;