166 lines
4.1 KiB
HTML
166 lines
4.1 KiB
HTML
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Basic Examples - Set DateTime In Input Field</title>
|
|
|
|
<link rel="stylesheet" type="text/css" href="../src/DateTimePicker.css" />
|
|
|
|
<script type="text/javascript" src="jquery-1.11.0.min.js"></script>
|
|
<script type="text/javascript" src="../src/DateTimePicker.js"></script>
|
|
|
|
<!--[if lt IE 9]>
|
|
<link rel="stylesheet" type="text/css" href="../src/DateTimePicker-ltie9.css" />
|
|
<script type="text/javascript" src="../src/DateTimePicker-ltie9.js"></script>
|
|
<![endif]-->
|
|
|
|
<style type="text/css">
|
|
|
|
p
|
|
{
|
|
margin-left: 20px;
|
|
}
|
|
|
|
input
|
|
{
|
|
width: 200px;
|
|
padding: 10px;
|
|
margin-left: 20px;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<!------------------------ Date Picker ------------------------>
|
|
<p>Date : </p>
|
|
<input type="text" data-field="date" data-format="dd-MMM-yyyy" class= "fillDateTime" id="date1" readonly>
|
|
|
|
<!------------------------ Time Picker ------------------------>
|
|
<p>Time : </p>
|
|
<input type="text" data-field="time" data-format="hh:mm AA" class= "fillDateTime" id="time1" readonly>
|
|
|
|
<!---------------------- DateTime Picker ---------------------->
|
|
<p>DateTime : </p>
|
|
<input type="text" data-field="datetime" data-format="dd-MMM-yyyy hh:mm:ss AA" class= "fillDateTime" id="datetime1" readonly>
|
|
|
|
|
|
<!------------------------ Date Picker ------------------------>
|
|
<p>Date : </p>
|
|
<input type="text" data-field="date" id="date2" readonly>
|
|
|
|
<!------------------------ Time Picker ------------------------>
|
|
<p>Time : </p>
|
|
<input type="text" data-field="time" id="time2" readonly>
|
|
|
|
<!---------------------- DateTime Picker ---------------------->
|
|
<p>DateTime : </p>
|
|
<input type="text" data-field="datetime" id="datetime2" readonly>
|
|
|
|
|
|
<!------------------------ Date Picker ------------------------>
|
|
<p>Date : </p>
|
|
<input type="text" data-field="date" data-format="yyyy-MM-dd" id="date3" readonly>
|
|
|
|
<!------------------------ Time Picker ------------------------>
|
|
<p>Time : </p>
|
|
<input type="text" data-field="time" data-format="hh:mm AA" id="time3" readonly>
|
|
|
|
<!---------------------- DateTime Picker ---------------------->
|
|
<p>DateTime : </p>
|
|
<input type="text" data-field="datetime" data-format="yyyy-MM-dd hh:mm:ss AA" id="datetime3" readonly>
|
|
|
|
|
|
<div id="dtBox"></div>
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function()
|
|
{
|
|
$("#dtBox").DateTimePicker(
|
|
{
|
|
|
|
dateFormat: "MM-dd-yyyy",
|
|
timeFormat: "HH:mm",
|
|
dateTimeFormat: "MM-dd-yyyy HH:mm:ss AA",
|
|
|
|
addEventHandlers: function()
|
|
{
|
|
var dtPickerObj = this;
|
|
|
|
/*
|
|
|
|
// Set DateTime Strings for all elements
|
|
|
|
*/
|
|
dtPickerObj.setDateTimeStringInInputField($("input"));
|
|
|
|
|
|
|
|
/*
|
|
|
|
// Set DateTime Strings for a single element
|
|
|
|
|
|
dtPickerObj.setDateTimeStringInInputField($("#date1"), new Date(2014, 4, 25, 0, 0, 0, 0));
|
|
dtPickerObj.setDateTimeStringInInputField($("#time1"), new Date(2014, 4, 25, 16, 40, 0, 0));
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
// Set DateTime Strings for a group of elements
|
|
|
|
|
|
dtPickerObj.setDateTimeStringInInputField($(".fillDateTime"));
|
|
|
|
*/
|
|
}
|
|
|
|
});
|
|
});
|
|
|
|
</script>
|
|
|
|
<!-- Default dateFormat: "dd-MM-yyyy"
|
|
|
|
dateFormat Options :
|
|
1. "dd-MM-yyyy"
|
|
2. "MM-dd-yyyy"
|
|
3. "yyyy-MM-dd"
|
|
|
|
Specify (data-min & data-max) / (minDate & maxDate) values in the same dateFormat specified in settings parameters
|
|
|
|
-->
|
|
|
|
<!-- Default timeFormat: "HH:mm"
|
|
|
|
timeFormat Options :
|
|
1. "HH:mm"
|
|
2. "hh:mm AA"
|
|
|
|
Specify (data-min & data-max) / (minTime & maxTime) values in the same timeFormat specified in settings parameters
|
|
-->
|
|
|
|
<!-- Default dateTimeFormat: "dd-MM-yyyy HH:mm:ss"
|
|
|
|
dateTimeFormat Options :
|
|
1. "dd-MM-yyyy HH:mm:ss"
|
|
2. "dd-MM-yyyy hh:mm:ss AA"
|
|
3. "MM-dd-yyyy HH:mm:ss"
|
|
4. "MM-dd-yyyy hh:mm:ss AA"
|
|
5. "yyyy-MM-dd HH:mm:ss"
|
|
6. "yyyy-MM-dd hh:mm:ss AA"
|
|
|
|
Specify (data-min & data-max) / (minDateTime & maxDateTime) values in the same dateTimeFormat specified in settings parameters
|
|
-->
|
|
|
|
</body>
|
|
|
|
</html> |