在DateTime Picker中限制时间间隔 [英] Restricting time intervals in DateTime Picker
问题描述
我正在使用此来选择日期和时间.该文档没有提及时间选择器,但是无论如何都可以使用.
I'm using this to select date and time. The documentation does not mention about time picker, but it works anyhow.
HTML:
<div class="dateTimePicker">
<input name="start" type="text" value="">
<span class="add-on"><i class="time-icon"></i></span>
</div>
JS:
$(".dateTimePicker").datetimepicker({
pickDate: false,
pickTime: true,
useSeconds: false,
format: 'hh:mm'
});
一切正常.它显示了一个间隔为1 hour for hours, 3 minutes for minutes and 3 seconds for seconds.
This works all fine. It shows a selector with intervals of 1 hour for hours, 3 minutes for minutes and 3 seconds for seconds.
我的目标是将分钟间隔从3更改为15.当前,分钟选择器显示:00 03 06 etc
.我可以将其更改为00 15 30 45
吗?甚至有可能吗?或者还有其他时间选择器可以给我这种灵活性吗?
My aim is to change the intervals of minutes from 3 to 15. Currently, the selector for minutes shows: 00 03 06 etc
. Can I change it to 00 15 30 45
. Is this even possible or are there any other time pickers which give me this flexibility?
推荐答案
$(".dateTimePicker").datetimepicker({
step: 15
});
这是在jquery datetimepicker中设置时间间隔的方法
This is how sets interval in jquery datetimepicker
这篇关于在DateTime Picker中限制时间间隔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!