user3092953 user3092953 - 5 months ago 21
Javascript Question

JS Datepicker Format

I have purchased a template which comes with a date-picker.

However I cannot change the format, its currently showing the date as

MM/DD/YYYY hh:ii
I want to change this to
DD-MM-YYYY
(no time).

Here is the date picker:

<div id="minimum-dtpicker" class="input-group date">
<input type="text" class="form-control"><span class="input-group-addon"><span class="ti-calendar"></span></span>
</div>


And here is part of the
datepicker.js
script

$('#minimum-dtpicker').datetimepicker({
format : "DD-MM-YYYY",
locale: 'en-gb'
});


Any ideas why this is not working?

Answer

If it is using momentjs, you are able to specify the format as follows in their docs:

moment(<unformatted date goes here>).format("DD-MM-YYYY");
Comments