如何在JavaScript中添加月份到日期? [重复] - How to add months to a date in JavaScript? [duplicate]

问题:

This question already has an answer here: 这个问题在这里已有答案:

I want to add months to a date in JavaScript. 我想在JavaScript中添加几个月的日期。

For example: I am inserting date 06/01/2011 (format mm/dd/yyyy ) and now I want to add 8 months to this date. 例如:我正在插入日期06/01/2011 (格式mm/dd/yyyy ),现在我想在这个日期添加8个月。 I want the result to be 02/01/2012 . 我希望结果是02/01/2012

So when adding months, the year may also increase. 因此,当添加月份时,年份也可能会增加。


解决方案:

参考一: https://en.stackoom.com/question/NgXK
参考二: https://stackoom.com/question/NgXK
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章