-2
次のコードがありますが、次の日に取得できます。私は強くhttps://momentjs.com/を使用してお勧めしたい次の形式で翌日を取得する方法月、日、年(3月、31,2017)
var objToday = new Date(),
weekday = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'),
dayOfWeek = weekday[objToday.getDay()],
domEnder = function() { var a = objToday; if (/1/.test(parseInt((a + "").charAt(0)))) return ""; a = parseInt((a + "").charAt(1)); return 1 == a ? "" : 2 == a ? "" : 3 == a ? "" : "" }(),
dayOfMonth = today + (objToday.getDate() < 10) ? '' + objToday.getDate() + domEnder : objToday.getDate() + domEnder,
months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'),
curMonth = months[objToday.getMonth()],
nextMonth = months[objToday.getMonth() + 1],
curYear = objToday.getFullYear(),
curHour = objToday.getHours() > 12 ? objToday.getHours() - 12 : (objToday.getHours() < 10 ? "0" + objToday.getHours() : objToday.getHours()),
curMinute = objToday.getMinutes() < 10 ? "0" + objToday.getMinutes() : objToday.getMinutes(),
curSeconds = objToday.getSeconds() < 10 ? "0" + objToday.getSeconds() : objToday.getSeconds(),
curMeridiem = objToday.getHours() > 12 ? "PM" : "AM";
var today = ab + ":" + curMinute + "." + curSeconds + curMeridiem + " " + dayOfWeek + " " + dayOfMonth + " of " + curMonth + ", " + curYear;
dayOfMonth_formatted = parseInt(dayOfMonth);
currentDay_formatted = curMonth + " " + dayOfMonth + 1 + "," + " " + curYear;
tomorrow_formatted = curMonth + " " + dayOfMonth_tomorrow + "," + " " + curYear;
の可能性のある重複した[JavaScriptを、次の日の日付を取得](http://stackoverflow.com/questions/23081158/javascript-get-date-of-the-next-day) –
なぜだろう**の前に**の代わりに文字列として**書式設定した後に日付を増やしてみてください**? –
[JavaScriptの日付を増やす]の重複の可能性があります(http://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript) –