I\'m using the bootstrap ready date time picker from http://eonasdan.github.io/bootstrap-datetimepicker/ and it\'s working nicely but for one issue. I have a picker setup just f
Perfectly worked for me
jQuery('#datetimepicker1').datetimepicker({
use24hours: true,
format: "YYYY-MM-DD HH:mm ",
defaultDate: new Date(),
});
You can also use the parameters "use24hours" and "language" to do this, as follows:
$(function () {
$('.datetime').datetimepicker({
language: 'pt-br',
use24hours: true,
});
});
Because the picker script is using moment.js to parse the format string, you can read the docs there for proper format strings.
But for 24Hr time, use HH
instead of hh
in the format.
$(function () {
$('#startTime, #endTime').datetimepicker({
format: 'HH:mm',
pickDate: false,
pickSeconds: false,
pick12HourFormat: false
});
});
With seconds!
$('.Timestamp').datetimepicker({
format: 'DD/MM/YYYY HH:mm:ss'
});
To skip future dates:
$(function () {
var date = new Date();
var currentMonth = date.getMonth();
var currentDate = date.getDate();
var currentYear = date.getFullYear();
$('#datetimepicker,#datetimepicker1').datetimepicker({
pickTime: false,
format: "DD-MM-YYYY",
maxDate: new Date(currentYear, currentMonth, currentDate + 1)
});
});
$(function () {
$('#startTime, #endTimeContent').datetimepicker({
format: 'HH:mm',
pickDate: false,
pickSeconds: false,
pick12HourFormat: false
});
});
your selector seems to be wrong,please check it
Meridian pertains to AM/PM, by setting it to false you're indicating you don't want AM/PM, therefore you want 24-hour clock implicitly.
$('#timepicker1').timepicker({showMeridian:false});