The DateTimePicker allows the end user to select a value from a calendar or a time drop-down list. Direct input is also allowed. It supports configurable options for minimum and maximum value, the format, the interval between predefined hours in the time view, custom templates for "month" view of the calendar, start view and the depth of the navigation.
<input id="dateTimePicker" />
$(document).ready(function(){
$("#dateTimePicker").kendoDateTimePicker();
});
When a DateTimePicker is initialized, it will be displayed at the location of the target HTML element.
The DateTimePicker provides configuration options that can be set during initialization. Among the properties that can be controlled:
$(document).ready(function(){
$("#dateTimePicker").kendoDateTimePicker({
value: new Date(2000, 10, 10, 10, 0, 0),
min: new Date(1950, 0, 1, 8, 0, 0),
max: new Date(2049, 11, 31, 18, 0, 0)
})
});
DateTimePicker will set the value only if the entered datetime is valid and within the defined range.
$("#dateTimePicker").kendoDateTimePicker({
format: "MM/dd/yyyy hh:mm tt" //format is used to format the value of the widget and to parse the input.
});
$("#dateTimePicker").kendoDateTimePicker({
timeFormat: "hh:mm:ss tt" //this format will be used to format the predefined values in the time list.
});
The first rendered view can be defined with "start" option. Navigation depth can be controlled with "depth" option. Predefined views are:
$("#dateTimePicker").kendoDateTimePicker({
start: "year",
depth: "year"
});
$("#dateTimePicker").kendoDateTimePicker({
interval: 15
})
You can reference an existing DateTimePicker instance via jQuery.data(). Once a reference has been established, you can use the API to control its behavior.
var dateTimePicker = $("#dateTimePicker").data("kendoDateTimePicker");