I am using bootstrap date time picker in my web application, made in PHP/HTML5 and JavaScript. I am currently using one from here: http://tarruda.github.io/bootstrap-datetimepic
<script type="text/javascript">
$(function () {
$('#datepicker').datetimepicker({
format: 'YYYY/MM/DD'
});
});
</script>
I spent some time trying to figure this out due to the update with DateTimePicker
. You would enter in a format based off of moment.js documentation. You can use what other answers showed:
$('#datetimepicker').datetimepicker({ format: 'DD/MM/YYYY' });
Or you can use some of the localized formats moment.js provides to do just a date, such as:
$('#datetimepicker').datetimepicker({locale: 'fr', format: 'L' });
Using this, you are able to display only a time (LT) or date (L) based on locale. The documentation for datetimepicker wasn't clear to me that it automatically adapts to the input provided (date or only time) via moment.js
format. Hope this helps for those still looking.