如何写2018-01-23,而不是2018-1-23
获取本年 var year=new Date().getFullYear() ;
获取本月 var month = new Date().getMonth() + 1 < 10 ? "0" + (new Date().getMonth() + 1) : new Date().getMonth() + 1;获取本日 var day = new Date().getDate() < 10 ? "0" + new Date().getDate() : new Date().getDate();
赋值 $("#date").html(year+'-'+month+'-'+day);