Home > Software design >  How to add x days to unix timestamp
How to add x days to unix timestamp

Time:12-15

I have this:

let currentTS = Math.floor( new Date() / 1000)

and it works, it gives me the current date in a unix timestamp. But now I want to add 14 days to the unix timestamp.

How can I add 14 days to the unix timestamp, and return the unix timestamp with 14 days added to it?

CodePudding user response:

Just compute how many seconds are in 14 days and add it?

Math.floor( new Date() / 1000)   14 * 24 * 60 * 60
  • Related