I want to get the same date format when clicking on "Tomorrow" button. Currently it showing two different output on clicks. If anybody could provide the solution? Below is the JS code.
var today = new Date(),
dd = today.getDate(),
mm = today.getMonth()+1,
yyyy = today.getFullYear(),
nextDate = new Date(today.getTime() + (24 * 60 * 60 * 1000)),
tomorrow = nextDate.toDateString();
if(dd<10){
dd='0'+dd
}
if(mm<10){
mm='0'+mm
}
today = dd+'/'+mm+'/'+yyyy;
addEventListener("load", function(){
dateInput = document.getElementById('dateID');
dateInput.value = "";
}, false);
function currentDate(){
dateInput.value = today;
}
function tomorrowDate(){
dateInput.value = tomorrow;
}
/******************************
<div class="wrapper">
<input type="text" id="dateID" /><br />
<input type="button" value="Today" onclick="currentDate();" />
<input type="button" value="Tomorrow" onClick="tomorrowDate();" />
</div>