const date = new Date('August 19, 2020 23:15:30');
const event = new Date();
console.log(event.setDate(date.getDate() + 1));
this code is supposed to return a date but its not returnign a date instead it is returning a number 1603240915215
can some one help me to get the date instead of such number?
const date = new Date('August 19, 2020 23:15:30');
const event = new Date();
console.log(event.setDate(date.getDate() + 1));
this code is supposed to return a date but its not returnign a date instead it is returning a number 1603240915215
can some one help me to get the date instead of such number?
const dateObj = new Date(1603240915215);
.setDate
return milliseconds. You want to access the dateInstance instead:
const day = new Date('August 19, 2020 23:15:30'), nextDay = new Date();
nextDay.setDate(day.getDate()+1); console.log(nextDay.toString());