获取格式为yy-mm-dd的时间
var now=new Date(); function getTimeFun(now){ let year = now.getFullYear(); let month = ((now.getMonth()+1)<10?"0":"") + (now.getMonth()+1); let day = (now.getDate()<10?"0":"")+now.getDate(); time=year+'-'+month+"-"+day; console.log(time) return time; }; getTimeFun(now);