https://stackoverflow.com/questions/6040515/how-do-i-get-month-and-date-of-javascript-in-2-digit-format

 

("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 를 해야한다. 

+ Recent posts