DateTimePicker
Dividing Input Fields from
HTML
<link rel="stylesheet" href="http://jsfiddle.net/Sgvuv/1/jquery-ui-timepicker-addon.css">
<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.1/jquery-ui.js"></script>
<script src="http://www.narshagreen.com/jquery-ui-timepicker-addon.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css">
</br><small>Input the date to count</small></br>
<input class="countdown-timepicker mydate_date_year" id="get_from_php" name="get_from_php" type="text" size="5" value="" />
<input class="countdown-timepicker mydate_date_month" id="get_from_php" name="get_from_php" type="text" size="5" value="" />
<input class="countdown-timepicker mydate_date_day" id="get_from_php" name="get_from_php" type="text" size="5" value="" />
</br><small>The Time</small></br>
<input class="countdown-timepicker mydate_time_hour" id="get_from_php" name="get_from_php" type="text" size="5" value="" />
<input class="countdown-timepicker mydate_time_minute" id="get_from_php" name="get_from_php" type="text" size="5" value="" />
JavaScript
jQuery(document).ready(function() {
jQuery('.countdown-timepicker').datetimepicker({
// altField: ".time_alt", // we do not use it now ??
onSelect: function(dateText, inst) {
var pieces = dateText.split('/');
alert(pieces[0]);
alert(pieces[1]);
alert(pieces[2]);
var pieces2 = pieces[2].split(' ');// year AND time
//alert(pieces2);
alert(pieces2[0]); // only year
alert(pieces2[1]); // H:M
var timesplit = pieces2[1].split(':'); // Split the minute
alert(timesplit[0]); // minutes
alert(timesplit[1]); // seconds
jQuery('.mydate_date_day').val(pieces[0]);
jQuery('.mydate_date_month').val(pieces[1]);
jQuery('.mydate_date_year').val(pieces2[0]);
jQuery('.mydate_time_hour').val(timesplit[0]);
jQuery('.mydate_time_minute').val(timesplit[1]);
}
});
});