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
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
Try this:
var date = new Date(); // Now
date.setDate(date.getDate() + 3); // Set now + 3 days as the new date
console.log(date);
it will be simpler like this:
const now = new Date();
const threeDayLater = Math.floor(new Date(now.setDate(now.getDate() + 3)).getTime() / 1000)
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));