动物总动员电影免费观看,国产一线天在线观看,亚洲成人精品久久,www.夜色av.com,caoporn国产一区二区,国产精品毛片一区视频播不卡,91av456

龍巖易富通網(wǎng)絡(luò)科技有限公司

龍巖小程序開發(fā),龍巖分銷系統(tǒng)

js在當(dāng)前日期添加天、周、月、年

2024.12.11 | 952閱讀 | 0條評論 | javascript


//創(chuàng)建date

var nowDate = new Date();


//添加天數(shù)

nowDate.setDate(nowDate.getDate() + 1);


//添加周 添加周用添加天的方式,來添加七天,即為一周

nowDate.setDate(nowDate.getDate() + 7);


//添加月數(shù)

nowDate.setMonth(nowDate.getMonth() + 1);


//添加年數(shù)

nowDate.setYear(nowDate.getFullYear() + 1);



打印格式為年月日時分秒

const year = nowDate.getFullYear();

const month = (nowDate.getMonth() + 1).toString().padStart(2, '0');

const day = nowDate.getDate().toString().padStart(2, '0');

const hours = nowDate.getHours().toString().padStart(2, '0');

const minutes = nowDate.getMinutes().toString().padStart(2, '0');

const seconds = nowDate.getSeconds().toString().padStart(2, '0');

console.log(`${year}-${month}-${day} ${hours}:${minutes}:${seconds}`);


贊 (

發(fā)表評論

永寿县| 鄯善县| 怀宁县| 大埔区| 天祝| 荥经县| 喀喇沁旗| 潮安县| 巫山县| 武穴市| 景东| 保定市| 孝感市| 湄潭县| 湾仔区| 育儿| 涪陵区| 苗栗市| 静宁县| 子长县| 茂名市| 洛宁县| 海安县| 兴和县| 亚东县| 兴业县| 高淳县| 襄汾县| 康乐县| 如皋市| 达日县| 博爱县| 宁陕县| 绥宁县| 偏关县| 剑阁县| 临漳县| 汨罗市| 玉林市| 宜兰县| 武强县|