IT/WEB
javascript date, month 날짜계산
iezs
2019. 5. 8. 15:07
("0" + this.getDate()).slice(-2)
for the date, and similar:
("0" + (this.getMonth() + 1)).slice(-2)
for the month.
근데 이것만으로는 안된다. 1월일때 -3 개월하면... -2라고 들어간다;
해서
d.setMonth(d.getMonth()-3);
이런식으로 setMonth 를 해야한다.