Set Default Date Bootstrap Datepicker

前端 未结 9 1293
暗喜
暗喜 2021-02-12 14:15

How to set a default date in Bootstrap Datepicker?

I want to set a date : 24/12/2006

When I open datepicker it should show me this date select on calender.

9条回答
  •  故里飘歌
    2021-02-12 14:53

    Above accepted solution is staled, To help others who has the newest files, if you have Version 4 or newer, and you want to call a method, here is an example for bootstrap datetimepicker method :

    $('#eventDate').data("DateTimePicker").date(moment(date).format('YYYY-MM-DD'));
    

    bootstrap.datetimepicker format Option sample :

     $('#eventDate').datetimepicker({ format: 'YYYY-MM-DD' });
    

    for more see here (but without valid sample :) ): http://eonasdan.github.io/bootstrap-datetimepicker/Options/

提交回复
热议问题