I have a date in the format mm/dd/yy
and want to add 30 days to it. I am just curious the best method to do this? I am new to javascript so examples would be he
A simple way to get it done is to send the timestamp value in the Date
constructor. To calculate 30 days measured in timestamp:
30 * 24 * 60 * 60 * 1000
Then, you need the current timestamp:
Date.now()
Finally, sum both values and send the result as a param in the constructor:
var nowPlus30Days = new Date(Date.now() + (30 * 24 * 60 * 60 * 1000));