How to dynamically set bootstrap-datepicker's date value?

Solution 1:

This works for me

$(".datepicker").datepicker("update", new Date());

Solution 2:

var startDate = new Date();

$('#dpStartDate').data({date: startDate}).datepicker('update').children("input").val(startDate);

another way

$('#dpStartDate').data({date: '2012-08-08'});
$('#dpStartDate').datepicker('update');
$('#dpStartDate').datepicker().children('input').val('2012-08-08');
  1. set the calendar date on property data-date
  2. update (required)
  3. set the input value (remember the input is child of datepicker).

this way you are setting the date to '2012-08-08'