时间格式不适用于dateTimePicker

Time Format not working for dateTimePicker

本文关键字:dateTimePicker 适用于 不适用 格式 时间      更新时间:2023-09-26

我从http://trentrichardson.com/examples/timepicker/

我得到了日期和时间,但它是24小时的格式,我希望它是12小时的格式和上午/下午。

我试过这个:

$('.emltdp-emltd-test').datetimepicker({
    timeFormat: 'hh:mm tt',
});

但它不起作用。

我没有发现你的代码有任何问题,如果它与你发布的内容相匹配,我可以验证它是否有效。只要确保你的实际代码中没有任何拼写或大写错误。

$(function(){
  $('.emltdp-emltd-test').datetimepicker({
    timeFormat: 'hh:mm tt',
  });
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/themes/smoothness/jquery-ui.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script>
<script src="http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js"></script>
<link rel="stylesheet" href="http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.css" />
<input class="emltdp-emltd-test" />