24小时及以上uiDatePicker [英] 24hr & uiDatePicker

查看:59
本文介绍了24小时及以上uiDatePicker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将uiDatePicker中的时间设置为24小时格式,我知道如果设备设置为显示AM/PM,则无法强制使用此模式? 如果是这样,我如何才能检测到设备处于24小时模式(或不处于24小时模式),以便可以将12次添加到我的PM时间中? 非常感谢您的帮助...

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...

推荐答案

好吧,您需要设置本地:

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;

这篇关于24小时及以上uiDatePicker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆