Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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'
});

This works all fine. It shows a selector with intervals of 1 hour for hours, 3 minutes for minutes and 3 seconds for seconds.

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?

like image 965
user2354302 Avatar asked Nov 17 '14 10:11

user2354302


People also ask

How do I limit DatePicker?

You can restrict the users from selecting a date within the particular range by specifying MinDate and MaxDate properties. The default value of MinDate property is 1/1/1920 and MaxDate property is 12/31/2120 . Dates that appears outside the minimum and maximum date range will be disabled (blackout).

What is time picker interval?

By default, the Interval for the Time Picker is 15 minutes, 30 minutes, and 1 hour. However, by adding a small code snippet to your site, you can easily create as many different Intervals for your form.

Which controls are used to select date and time?

A date and time picker (DTP) control provides a simple and intuitive interface through which to exchange date and time information with a user. For example, with a DTP control you can ask the user to enter a date and then easily retrieve the selection.


1 Answers

$(".dateTimePicker").datetimepicker({
    step: 15 
});

This is how sets interval in jquery datetimepicker

like image 185
Fabricio Fogaça Avatar answered Sep 29 '22 05:09

Fabricio Fogaça