Let's assume you store the number of days to add in a variable called days_to_add. Then this short one should do it: calc_date = new Date(Date.now() +(days_to_add * 86400000)); With Date.now() you get the actual unix timestamp as milliseconds and then you add as many milliseconds as you want to add days to
var today =new Date(); var in_a_week =new Date().setDate(today.getDate()+7); var ten_days_ago=new Date().setDate(today.getDate()-10)
ute * 60
utes (from 0-59.
Adding one day to current date: 2017-10-19 Adding days to the current date: 2017-10-25 Adding one day to the given date: 2016-10-15 Adding days to the given date: 2016-10-23 Related Articles: 1. Java - How to get current Date and Time 2. Getting current date and time in Java 8 3. Java Date format 4. Java Date Parsing 5
So, the date object, correctly handles the situation where you add, or subtract days beyond of the current month, and/or year. michael1174, what, exactly, do you mean when you say: The days are not adding up correctly though