如何让bootstrap-datetimepicker以15分钟的间隔显示时间

时间:2016-09-16 19:22:50

标签: javascript jquery asp.net-mvc bootstrap-modal

这是我的Javascript代码,在第1区间以分钟为单位递增

fillMinutes = function () {
            var table = widget.find('.timepicker-minutes table'),
                currentMinute = viewDate.clone().startOf('h'),
                html = [],
                row = $('<tr>'),
                step = options.stepping === 1 ? 5 : options.stepping;

            while (viewDate.isSame(currentMinute, 'h')) {
                if (currentMinute.minute() % (step * 4) === 0) {
                    row = $('<tr>');
                    html.push(row);
                }
                row.append('<td data-action="selectMinute" class="minute' + (!isValid(currentMinute, 'm') ? ' disabled' : '') + '">' + currentMinute.format('mm') + '</td>');
                currentMinute.add(step, 'm');
            }
            table.empty().append(html);
        }

我想修改它以在15分钟间隔内增加。 有人可以帮我这个。

2 个答案:

答案 0 :(得分:5)

val rdd2 = indexedData.map{case (x,y) => (x, y.toArray(2))} rdd2.foreach(println) (0,75.0) (1,77.0) (2,82.0) (3,56.0) (4,47.0) (5,38.0) (6,59.0) (7,61.0) (8,80.0) (9,99.0) 的选项是我认为你想要的,就像这样:

stepping

以下是<script type="text/javascript"> $(function () { $('#yourTimePickerElement').datetimepicker({ stepping: 15 }); }); </script> 的文档:

<强>步进

  

默认值:1

上/下箭头将在时间选择器中移动分钟值的分钟数

Bootstrap 3 Datepicker documentation

答案 1 :(得分:0)

incrementMinutes: function () {
                    var newDate = date.clone().add(15, 'm');
                    if (isValid(newDate, 'm')) {
                        setValue(newDate);
                    }
                }



decrementMinutes: function () {
                    var newDate = date.clone().subtract(15, 'm');
                    if (isValid(newDate, 'm')) {
                        setValue(newDate);
                    }
                }