<div>
开始时间:<input type="date" name="course" id = "datePicker" value="" />
<script>
window.onload = function qww(){
//创建一个当bai前日期对象
var now = new Date();
//格式化日,如果小于9,前面补0
var day = ("0" + now.getDate()).slice(-2);
//格式化月,如果小于9,前面补0
var month = ("0" + (now.getMonth() + 1)).slice(-2);
//拼装完整日期格式
var today = now.getFullYear()+"-"+(month)+"-"+(day) ;
//完成赋值
$('#datePicker').val(today);
console.log(day);
console.log(month);
console.log(today);
};
</script>
</div>
<div>
结束时间:<input type="date" name="course" id = "datePicker" value="" />
<script>
window.onload = function eew(){
//创建一个当bai前日期对象
var now = new Date();
//格式化日,如果小于9,前面补0
var day = ("0" + now.getDate()).slice(-2);
//格式化月,如果小于9,前面补0
var month = ("0" + (now.getMonth() + 1)).slice(-2);
//拼装完整日期格式
var today = now.getFullYear()+"-"+(month)+"-"+(day) ;
//完成赋值
$('#datePicker').val(today);
console.log(day);
console.log(month);
console.log(today);
};
</script>
</div>
开始时间:<input type="date" name="course" id = "datePicker" value="" />
<script>
window.onload = function qww(){
//创建一个当bai前日期对象
var now = new Date();
//格式化日,如果小于9,前面补0
var day = ("0" + now.getDate()).slice(-2);
//格式化月,如果小于9,前面补0
var month = ("0" + (now.getMonth() + 1)).slice(-2);
//拼装完整日期格式
var today = now.getFullYear()+"-"+(month)+"-"+(day) ;
//完成赋值
$('#datePicker').val(today);
console.log(day);
console.log(month);
console.log(today);
};
</script>
</div>
<div>
结束时间:<input type="date" name="course" id = "datePicker" value="" />
<script>
window.onload = function eew(){
//创建一个当bai前日期对象
var now = new Date();
//格式化日,如果小于9,前面补0
var day = ("0" + now.getDate()).slice(-2);
//格式化月,如果小于9,前面补0
var month = ("0" + (now.getMonth() + 1)).slice(-2);
//拼装完整日期格式
var today = now.getFullYear()+"-"+(month)+"-"+(day) ;
//完成赋值
$('#datePicker').val(today);
console.log(day);
console.log(month);
console.log(today);
};
</script>
</div>