function getNowFormatDay()
{
//显示当前时间
function completeDate(value)
{
return value < 10 ? '0' + value : value
}
var char = '-'
var nowDate = new Date()
var day = nowDate.getDate()
var month = nowDate.getMonth() + 1 //注意月份需要+1
var year = nowDate.getFullYear()
//补全0,并拼接
return year + char + completeDate(month) + char + completeDate(day)
}
js获取当前日期yyyy-MM-dd
最新推荐文章于 2023-08-31 14:22:47 发布