js 当前日期格式化 YYYY-MM-DD

var now = new Date();
var time = now.getFullYear() + "-" +((now.getMonth()+1)<10?"0":"")+(now.getMonth()+1)+"-"+(now.getDate()<10?"0":"")+now.getDate();

posted @ 2021-07-30 15:47  helloSWZ  阅读(1334)  评论(0)    收藏  举报