📌  相关文章
📜  如何在 js 中获取当前日期 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:48.846000             🧑  作者: Mango

代码示例6
let today = new Date();
let month = today.getMonth() + 1;
month = month < 10 ? "0" + month : month;
let days = today.getDate() < 10 ? "0" + today.getDate() : today.getDate();

today = today.getFullYear() + "-" + month + "-" + days;

console.log(today);