javascript - jquery.datetimepicker set time only - Stack Overflow

I used .I want to show and enter only time.My code is:$('#dttf').datetimepicker({datepicker

I used . I want to show and enter only time. My code is:

$('#dttf').datetimepicker({
    datepicker:false,
    step:15,
    format: 'H:m'});

It is showed only time from 15 minutes, starting with exact time, e.g. 9:00,9:15,9:30, etc. The problem is when I select time, 9:15 by example, it shows me 9:17, the current time. I want to show what I selected, 9:15. I tried many options, but no one seems to work.

I used https://github./xdan/datetimepicker. I want to show and enter only time. My code is:

$('#dttf').datetimepicker({
    datepicker:false,
    step:15,
    format: 'H:m'});

It is showed only time from 15 minutes, starting with exact time, e.g. 9:00,9:15,9:30, etc. The problem is when I select time, 9:15 by example, it shows me 9:17, the current time. I want to show what I selected, 9:15. I tried many options, but no one seems to work.

Share asked Mar 25, 2018 at 7:09 ghingaiaghingaia 331 silver badge3 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 2

You need to use H:i as the format string instead of H:m.

$("#date").datetimepicker({
  datepicker: false,
  step: 15,
  format: 'H:i'
});
@import 'https://unpkg./[email protected]/build/jquery.datetimepicker.min.css';
<script src="https://ajax.googleapis./ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://unpkg./jquery-datetimepicker"></script>


<input type="text" id="date">

$(function(){
   $('#example').timepicker(); 
});
<script src="https://ajax.googleapis./ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare./ajax/libs/jquery-timepicker/1.10.0/jquery.timepicker.js"></script>
<link href="https://cdnjs.cloudflare./ajax/libs/jquery-timepicker/1.10.0/jquery.timepicker.min.css" rel="stylesheet"/>
<input type="text" id="example" />

Hope this helps you

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744949558a4602834.html

相关推荐

  • javascript - jquery.datetimepicker set time only - Stack Overflow

    I used .I want to show and enter only time.My code is:$('#dttf').datetimepicker({datepicker

    2天前
    70

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信