1
votes

Running into some issues with Bootstrap Datepicker. I have used it successfully on the site already, however for the life of me I cannot seem to get it working again.

I have a number of dates and declared the necessary JavaScript files (jQuery.min.js and bootstrap-datepicker). I then call the date i.e. 39, which works correctly and brings up the date. However, when I click on the date, it displays the date in mm/dd/yyyy rather than the desired dd/mm/yyyy.

Note: There are values already in the input boxes pulled from a database in the correct format also, however this has a negative effect when bootstrap datepicker shows the data in the wrong format!

    $('#date38').datepicker({
        format: "dd/mm/yyyy"
    }); 
    $('#date39').datepicker({
        format: "dd/mm/yyyy"
    }); 
    $('#date40').datepicker({
        format: "dd/mm/yyyy"
    });
1
@DanielWeiß that actually worked, from what I read, you werent meant to use that, hence why I didnt in the first place. Thanks! - Frog82
Are there more code? because this dont say much, make a test. just put 1 "#date38" and delete the other 2 for see how this work. - CoolLife

1 Answers

0
votes

Try to use datetimepicker by using bootstrap, it will something like this,

$('#date38').datetimepicker({
    format: "dd/mm/yyyy"
}); 
$('#date39').datetimepicker({
    format: "dd/mm/yyyy"
}); 
$('#date40').datetimepicker({
    format: "dd/mm/yyyy"
});

BTW, if you are using jquery-ui datepicker. it will something like that

$('#date38').datepicker({
    dateFormat: "dd/mm/yyyy"
}); 
$('#date39').datepicker({
    dateFormat: "dd/mm/yyyy"
}); 
$('#date40').datepicker({
    dateFormat: "dd/mm/yyyy"
});