📜  在javascript jquery中获取日期并更改格式并增加日期或月份 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:03:03.035000             🧑  作者: Mango

代码示例1
month = Number($("#con_months_of_contract").val());

var date = $('#datepicker2').val();
var newdate = date.split("-").reverse().join("-");
var myDate = new Date(newdate);
// select month one change
var newDate2 = new Date(myDate.setMonth(myDate.getMonth()+month));
//renewal date is -1 
newDate2.setDate(newDate2.getDate()-1);
$("#datepicker4").datepicker("setDate", newDate2);

//@sujay