关于datetimepicker只显示年、月、日的设置

时间:2025-01-26 10:37:02

如下是只显示月的sample code:

<link rel="stylesheet" href="css/datetimepicker/bootstrap-datetimepicker.min.css">
<script src="js/datetimepicker/bootstrap-datetimepicker.js"></script>

<input type="text"  class="form-control form_datetime_2" readonly style="background:#fff" placeholder="开始时间" id="begin_month_time"/>

//只显示年的

<script>
$(".form_datetime_2").
    datetimepicker({
    language:'ch',
    format: 'yyyy',
    autoclose: true,
    todayBtn: true,
    startView: 'decade',
    minView:'decade',
    maxView:'decade',
});

</script>

关于datetimepicker只显示年、月、日的设置

//只显示月的

<script>
$(".form_datetime_2").
datetimepicker({
    language:'ch',
    format: 'MM',
    autoclose: true,
    todayBtn: true,
    todayHighlight: true,
    startView: 'year',
    minView:'year',
    maxView:'year',
});
</script>

关于datetimepicker只显示年、月、日的设置

<script>
    $(".form_datetime_2").
    datetimepicker({
    language:'ch',
    format: 'dd',
    autoclose: true,
    todayBtn: true,
todayHighlight: true,
startView: 'month',
minView:'month',
maxView:'month',
});
</script>

关于datetimepicker只显示年、月、日的设置