twitter-bootstrap 24 小时格式的日期范围选择器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36373626/
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
Date Range Picker in 24 hour format
提问by Arvind
I am using the Date Range Pickerplugin for bootstrap and I am trying to get the values in 24hour format. I have set the option timePicker24Hour: truebut it still doesn't return it in 24 hour format.
我正在使用日期范围选择器插件进行引导,并且我正在尝试以 24 小时格式获取值。我已经设置了该选项,timePicker24Hour: true但它仍然没有以 24 小时格式返回它。
This is my code:
这是我的代码:
$("#reportdatetime").daterangepicker({
timePicker: true,
timePicker24Hour: true,
timePickerIncrement: 30,
locale: {
format: 'MM/DD/YYYY h:mm'
}
});
回答by Arvind
Use the correct locale format.To display time in 24 hours format use the following -
使用正确的语言环境格式。要以 24 小时格式显示时间,请使用以下内容 -
$("#reportdatetime").daterangepicker({
timePicker: true,
timePicker24Hour: true,
timePickerIncrement: 30,
locale: {
format: 'MM/DD/YYYY H:mm'
}
});
working example : https://jsfiddle.net/Ly0jh5pz/2
回答by Hirendrasinh S. Rathod
<script>
$('#datepicker').daterangepicker({
"timePicker": true,
"timePicker24Hour": true,
"startDate": "03/27/2016",
"endDate": "04/02/2016"
});
});
</script>

