I have this:
const days = Math.floor(Date.now() 3 * (3600 * 1000 * 24))
Is this correct for 3 days??? I need it in milliseconds format
CodePudding user response:
it will be simpler like this:
const now = new Date();
const threeDayLater = Math.floor(new Date(now.setDate(now.getDate() 3)).getTime() / 1000)
CodePudding user response:
Try this:
var date = new Date(); // Now
date.setDate(date.getDate() 3); // Set now 3 days as the new date
console.log(date);
CodePudding user response:
You can create a new Date out of days, and check it yourself:
const days = Math.floor(Date.now() 3 * (3600 * 1000 * 24))
console.log(new Date(days));