欧美一级色视频,簧片在线免费看,美日韩在线,成人观看网站a,亚洲欧美在线一区二区,欧美操穴,欧美综合专区

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

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

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

2024.12.11 | 1666閱讀 | 0條評(píng)論 | javascript


//創(chuàng)建date

var nowDate = new Date();


//添加天數(shù)

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


//添加周 添加周用添加天的方式,來(lái)添加七天,即為一周

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


//添加月數(shù)

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


//添加年數(shù)

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



打印格式為年月日時(shí)分秒

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ā)表評(píng)論

孟连| 陆丰市| 嵊泗县| 英山县| 东乌珠穆沁旗| 西城区| 增城市| 同心县| 会理县| 夏河县| 枣庄市| 柏乡县| 墨竹工卡县| 阳江市| 张家港市| 昭通市| 伊金霍洛旗| 本溪市| 梨树县| 隆回县| 镶黄旗| 定结县| 车险| 苏尼特左旗| 洛南县| 恩平市| 涿州市| 江源县| 崇阳县| 武功县| 沅陵县| 理塘县| 阿拉善右旗| 九江市| 黔南| 高安市| 扬州市| 昌黎县| 扶沟县| 临泽县| 建宁县|