Add 30 days to date (mm/dd/yy)

后端 未结 4 2098
耶瑟儿~
耶瑟儿~ 2020-12-03 16:59

I have a date in the format mm/dd/yy and want to add 30 days to it. I am just curious the best method to do this? I am new to javascript so examples would be he

4条回答
  •  旧巷少年郎
    2020-12-03 17:51

    try

    new Date(+yourDate - 30 *86400000)
    

    var yourDate = new Date() 
    var newDate = new Date(+yourDate - 30 *86400000)
    
    console.log(newDate)

提交回复
热议问题