📜  在 javascript 代码示例中格式化日期

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

代码示例6
const formatDate = date => {
  return (
    date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
  );
};

console.log(formatDate(new Date()));