let date = new Date()
Date.prototype.formate = function() {
let year = this.getFullYear()
let month = this.getMonth() + 1
let date = this.getDate()
return `${year}年${month}月${date}日`
}
console.log(date.formate());
使用原型来设置获取中文日期
最新推荐文章于 2022-03-29 15:15:45 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)