Jquery datetimepicker - Advance time by 1 hour

后端 未结 3 512
遇见更好的自我
遇见更好的自我 2021-01-15 08:35

I\'m currently using the jQuery datetimepicker add-on from here

It works just about perfectly, but I\'m stumped on how to add a small bit of functionality to it. I c

3条回答
  •  梦谈多话
    2021-01-15 08:50

    There is a Get and Set Datetime function shown near the bottom of the page.

    var ex13 = $('#example13');
    
    ex13.datetimepicker();
    
    $('#example13_setdt').click(function(){
        ex13.datetimepicker('setDate', (new Date()) );
    });
    
    $('#example13_getdt').click(function(){
        alert(ex13.datetimepicker('getDate'));
    });
    

    Could you use that? Or course you'll have to add an hour to the getDate.

    $("#endtime").datetimepicker("setDate", $("#starttime").datetimepicker("getDate"));
    

提交回复
热议问题