I used Daterangepicker and timepicker in that after i click the apply button it show only selected date not time. i need bothe selected date and time anyone help me. my code is,
$(document).ready(function() {
$('#config-demo').daterangepicker({
locale: {
format: 'DD/MMM/YYYY'
},
"singleDatePicker": true,
"timePicker": true,
"timePickerIncrement": 10,
startDate: '<?php echo date("m-d-Y"); ?>', //09-21-2016
},
function(start, end, label) {
$('#config-demo').val(start.format('DD-MM-YYYY'));
});
});
$("#config-demo").on('apply.daterangepicker', function(ev, Picker) {
$('#config-demo').val(Picker.startDate.format('DD-MM-YYYY'));
});
Thanks.
You need to pass time(H:i:s) parameter with the date format
Try below code:
$(document).ready(function() {
$('#config-demo').daterangepicker({
locale: {
format: 'DD/MMM/YYYY hh:mm:ss A'
},
"singleDatePicker": true,
"timePicker": true,
"timePickerIncrement": 10,
startDate: '<?php echo date("m-d-Y"); ?>', //09-21-2016
},
function(start, end, label) {
$('#config-demo').val(start.format('DD-MM-YYYY hh:mm:ss A'));
});
});
$("#config-demo").on('apply.daterangepicker', function(ev, Picker) {
$('#config-demo').val(Picker.startDate.format('DD-MM-YYYY hh:mm:ss A'));