问题
I want to display the date only without the time on the text , but it seems that it didn't work even I've set the format of the datepicker. And also I dont want to display the Time in the datepicker. Please see image below, I want to remove the yellow highlighted.
var defaultFormat = { dateFormat: 'mm/dd/yy' };
$.datepicker.setDefaults(defaultFormat);
$('#EM_Date').datetimepicker({
showHour: false,
showMinute: false
});

回答1:
Use $( "#EM_Date" ).datepicker();
回答2:
use this format,
$('.picker').datetimepicker({ dateFormat:dateFormat: 'mm/dd/yy' '', timeFormat: 'hh:mm tt', dateonly:true });
回答3:
Function:
<script type="text/javascript">
$(function () {
$('.datePicker').datepicker({ dateFormat: 'yy-mm-dd' });
});
</script>
Input Field
<input type="text" name="date" id="date" class="datePicker" />
Example (date format dd/mm/yy):

来源:https://stackoverflow.com/questions/10611623/jquery-datepicker-should-display-date-only