This is how I get todays timestamp:
var timestampNow = Math.floor(Date.now() / 1000);
I want to set timestampNow to 4 weeks from now.
My initial guess is to use Math.floor(Date.now(28) / 1000);
?
This is how I get todays timestamp:
var timestampNow = Math.floor(Date.now() / 1000);
I want to set timestampNow to 4 weeks from now.
My initial guess is to use Math.floor(Date.now(28) / 1000);
?
I believe this would work:
let fourWeeksFromNow = new Date();
fourWeeksFromNow.setDate(fourWeeksFromNow.getDate() + 28)
javascript isn't that great when it comes to dates, so you need to parse the date to a timestamp and modify the milliseconds. but the maths is not very hard.
var timestamp4weeks = Date.now() + (1000 * 60 * 60 * 24 * 7 * 4)
* 1000
* 60
* 60
* 24
* 7