【问题标题】:Time Format not working for dateTimePicker时间格式不适用于 dateTimePicker
【发布时间】:2015-04-02 13:29:18
【问题描述】:

我从以下位置下载了 javascript 和所需的 css 文件 http://trentrichardson.com/examples/timepicker/

我正在获取日期和时间,但它是 24 小时格式的,我希望它是 12 小时格式的上午/下午。

我试过了:

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

但它不起作用。

【问题讨论】:

  • 您可以在这里找到答案:stackoverflow.com/questions/8847109/…
  • @DwightDavidDesotelleJr。 - OP 要求帮助使用特定的 jQuery 小部件库。您链接到的帖子与问题中的库无关。
  • From the OP: "谢谢#JDB 我忘了补充一些东西。:)"

标签: javascript jquery date time


【解决方案1】:

我没有发现您的代码有任何问题,如果它与您发布的内容匹配,我可以验证它应该工作。只需确保您的实际代码中没有任何拼写或大写错误即可。

$(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" />

【讨论】:

  • 谢谢#JDB 我忘了添加一些东西。 :)
猜你喜欢
  • 2021-03-28
  • 1970-01-01
  • 2016-04-08
  • 2018-03-03
  • 2017-05-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多