DateTimePicker time picker in 24 hour but displaying in 12hr?

前端 未结 13 1228
孤独总比滥情好
孤独总比滥情好 2021-02-02 09:17

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

13条回答
  •  孤街浪徒
    2021-02-02 10:06

    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)
        });
    });
    

提交回复
热议问题