JQuery Datepicker should display date only

匆匆过客 提交于 2019-12-10 16:59:22

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!