在引导日期时间选择器中设置默认时间? [英] Set default time in bootstrap datetimepicker?

查看:56
本文介绍了在引导日期时间选择器中设置默认时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将默认的小时和分钟设置为"00:00".在这里,我只想设置时间而不是日期.我将以下代码用于datetimepicker.在这段代码中,如何将默认时间设置为"00:00"?

How can I set the default Hours and minutes as "00:00". Here I want to set only time not date. I am using the following code for datetimepicker. In this code how can I set the default time as "00:00"?

    $('#timepicker'+rowIndx).datetimepicker({
				format : "dd/MM/yyyy hh:mm",										
				pickSeconds:false, 		
	}).on("show",function(e) {
		if($("#from_Date"+ rowIndx).val() == ""){		                                                   $('#timepicker'+rowIndx).datetimepicker("setDate", "");					
	}																
	}).on('changeDate', function(e) {
				isExtraTcAmountDateChanged = "Y";
	});

推荐答案

Bootstrap datetimepicker使用力矩库,因此像这样使用它,

Bootstrap datetimepicker uses moment library so make use of it like this,

var dateNow = new Date();
$('#current_date').datetimepicker({
    defaultDate:moment(dateNow).hours(0).minutes(0).seconds(0).milliseconds(0)
});

这篇关于在引导日期时间选择器中设置默认时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆