当我们对date
对象调用getMonth()
和getDate()
时,我们将获得single digit number
.
例如:
对于january
,它显示1
,但我需要将其显示为01
.怎么做?
当我们对date
对象调用getMonth()
和getDate()
时,我们将获得single digit number
.
例如:
对于january
,它显示1
,但我需要将其显示为01
.怎么做?
("0" + this.getDate()).slice(-2)
日期及类似信息:
("0" + (this.getMonth() + 1)).slice(-2)
这个月.