Search code examples
jquerytwitter-bootstrapdefault-valuebootstrap-datetimepicker

Can't set a default date value for bootstrap datetimepicker


How can I set a default value for the bootstrap datetimepicker?

Here's my code:

jQuery(function () {

        var myStartDate = $('#myStartDate').val();

        jQuery('#startDate').datetimepicker({
            locale: 'de',
            format: 'dd, DD.MM.YYYY, HH:mm',
            minDate: moment(),          
        });
    });

The variable "myStartDate" is a java.util.date saved in an input hidden field. Is there parameter to set the default value? Any suggestions?


Solution

  • Set the defaultDate

        jQuery('#startDate').datetimepicker({
            locale: 'de',
            format: 'dd, DD.MM.YYYY, HH:mm',
            defaultDate: "11/1/2016",
            minDate: moment(),          
        });