twitter-bootstrap 视图侧没有 AM/PM 按钮的 Twitter Bootstrap 时间选择器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25767950/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 21:30:41  来源:igfitidea点击:

Twitter Bootstrap timepicker without AM/PM button in View side

javascripttwitter-bootstraptimepicker

提问by DaniKR

I have this timepicker with bootstrap: Demo

我有这个带引导程序的时间选择器:演示

Now I whant to hide AM/PM, is it possible to do with javascript. Or I will have to remove it from bootstrap.timepicker.js?

现在我想隐藏 AM/PM,是否可以使用javascript. 或者我将不得不从中删除它bootstrap.timepicker.js

I have try with this:

我试过这个:

$('#timepicker1').timepicker({
    defaultTime: 'value',
    minuteStep: 1,
    disableFocus: true,
    format: 'HH:mm',
    template: 'dropdown'
});

But this is not working.

但这行不通。

Realy thanks for any help

非常感谢您的帮助

回答by VPK

Add option showMeridianas follows,

添加选项showMeridian如下,

$('#timepicker1').timepicker({
    defaultTime: 'value',
    minuteStep: 1,
    disableFocus: true,
    template: 'dropdown',
    showMeridian:false
});

This property has default value as truewhich makes the API to operate in 12hr mode. By setting it to falseturns it to operate in 24hr mode.

此属性具有默认值true,使 API 以 12 小时模式运行。通过将其设置为false使其在 24 小时模式下运行。

回答by WhiteAngel

Unforunately, your library doesn't have format option, but you can use 24-hour format:

不幸的是,您的图书馆没有格式选项,但您可以使用 24 小时格式:

showMeridian: false

I've updated your jsfiddle: http://jsfiddle.net/C3b4t/69/

我已经更新了你的 jsfiddle:http: //jsfiddle.net/C3b4t/69/

If you want to use 'format' parameter I would suggest you to use datetimepicker: Bootstrap datetimepicker

如果您想使用“格式”参数,我建议您使用datetimepickerBootstrap datetimepicker