我在Javascript中设置了一些未来的日期:
var today = new Date(),
dd = today.getDate(),
mm = today.getMonth() + 1, // January is 0
yyyy = today.getFullYear(),
mmPlusThree = mm + 3,
mmPlusFour = mm + 4;
if (dd < 10) {
dd = '0' + dd;
}
if (mm < 10) {
mm = '0' + mm;
}
var todayDateString = mm + '/' + dd + '/' + yyyy,
threeMonthDateString = mmPlusThree + '/' + dd + '/' + yyyy,
fourMonthDateString = mmPlusFour + '/' + dd + '/' + yyyy;
如何更新yyyy
或threeMonthDateString
的{{1}}?或者是否有更好的方法来获取未来三个月和四个月的格式化字符串(即fourMonthDateString
)?