简体   繁体   English

jQuery DateTime Picker Previous Time设置为0

[英]Jquery DateTime Picker Previous Time setting to 0

I am using Jquery Datetime Picker,all is running fine apart from the date. 我正在使用Jquery Datetime Picker,除日期外,一切运行良好。 I load the page in ASP.NET and set the datetime value from codebehind. 我将页面加载到ASP.NET中并从codebehind设置datetime值。

When i click on calender icon it load up the datetime but it sets the time to 00:00:00, however the date remain the same. 当我单击日历图标时,它将加载日期时间,但将时间设置为00:00:00,但是日期保持不变。

I have attached the screenshot. 我已经附上了屏幕截图。

http://tinypic.com/r/6ycfhu/5 http://tinypic.com/r/6ycfhu/5

after clicking calender icon http://tinypic.com/r/15qzon5/5 单击日历图标http://tinypic.com/r/15qzon5/5后

How can i prevent this so when you click the calender icon it loads up the preselected time do not reset it to 00:00:00 Any advice/Help 我如何防止这种情况,所以当您单击日历图标会加载预选的时间时,请勿将其重置为00:00:00任何建议/帮助

Thank you. 谢谢。

i found the solution by myself the following two functions will repopulate the date and time.and upon clicking it will not reset the time to 0.hence will load the time and put the sliders accordingly. 我自己找到了解决方案,以下两个功能将重新填充日期和时间。单击它不会将时间重置为0.因此将加载时间并相应地放置滑块。

var lDate = "";
     var id = "";
$(".ui-datepicker-trigger").hover(function () {
 var val = $(this).prev().val();
 lDate = val;
 id = $(this).prev().attr("id");
  });

         // SETTING DATETIME 
         $(".ui-datepicker-trigger").click(function () {
             var v = lDate.split(' ');
             // $('.ui-datepicker-trigger').prev().val(lDate);
             var d = v[0].split('/');
             var t = v[1].split(':');
             $('#' + id).datetimepicker("setDate", new Date(d[2], d[1]-1, d[0], t[0], t[1], t[2]));
         });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM