改变asp.net MVC中Telerik日期拾取器的文化

本文关键字:文化 日期 Telerik asp net MVC 改变 | 更新日期: 2023-09-27 18:12:30

现在我在asp.net mvc项目中有这个日期picker

 <div class="demo-section user-selection" style="height:138px;">
    <div class="dates">
        <h4>Start date:</h4>
        <span class="k-widget k-datepicker k-header" style="width: 100%; "><span class="k-picker-wrap k-state-default"><input id="start" style="width: 100%;" value="10/10/2015" data-role="datepicker" type="text" class="k-input" role="combobox" aria-expanded="false" aria-owns="start_dateview" aria-disabled="false" aria-readonly="false"><span unselectable="on" class="k-select" role="button" aria-controls="start_dateview"><span unselectable="on" class="k-icon k-i-calendar">select</span></span></span></span>
    </div>
    <div class="dates">
        <h4>End date:</h4>
        <span class="k-widget k-datepicker k-header" style="width: 100%;"><span class="k-picker-wrap k-state-default"><input id="end" style="width: 100%;" value="10/10/2015" data-role="datepicker" type="text" class="k-input" role="combobox" aria-expanded="false" aria-owns="end_dateview" aria-disabled="false" aria-readonly="false"><span unselectable="on" class="k-select" role="button" aria-controls="end_dateview"><span unselectable="on" class="k-icon k-i-calendar">select</span></span></span></span>
    </div>
    @*<div class="DateWarning">Maximum duration from start to end date is 5 days</div>*@
</div>

<script>
    $(document).ready(function () {
        function startChange() {
            var startDate = start.value(),
            endDate = end.value();
            if (startDate) {
                startDate = new Date(startDate);
                startDate.setDate(startDate.getDate());
                end.min(startDate);
            } else if (endDate) {
                start.max(new Date(endDate));
            } else {
                endDate = new Date();
                start.max(endDate);
                end.min(endDate);
            }
        }
        function endChange() {
            var endDate = end.value(),
            startDate = start.value();
            if (endDate) {
                endDate = new Date(endDate);
                endDate.setDate(endDate.getDate());
                start.max(endDate);
            } else if (startDate) {
                end.min(new Date(startDate));
            } else {
                endDate = new Date();
                start.max(endDate);
                end.min(endDate);
            }
        }
        var start = $("#start").kendoDatePicker({
            change: startChange,
        }).data("kendoDatePicker");
        var end = $("#end").kendoDatePicker({
            change: endChange
        }).data("kendoDatePicker");
        start.max(end.value());
        end.min(start.value());
    });

</script>

它工作正常,但问题是日期格式是美国(月/日/年)

,我想把它改成(日/月/年)有什么办法可以改变吗?

改变asp.net MVC中Telerik日期拾取器的文化

为kendoDatePicker方法添加区域性和格式,如:

.kendoDatePicker({
        change: startChange,
        culture:"nl-NL",
        format:"d-M-yyyy",
});