I'm having trouble adding minutes to a date in javascript in Node.js. I have a date object, bt_time = new Date()
bt_time.toString()
"Mon Mar 07 2016 03:30:10 GMT+0000 (UTC)"
The following operations attempting to add 5 minutes to the give the following results
bt_time + (60*1000*5)
"Mon Mar 07 2016 03:30:10 GMT+0000 (UTC)300000"
new Date(bt_time + (60*1000*5)).toString()
"Mon Mar 07 2016 03:30:10 GMT+0000 (UTC)"
new Date(bt_time) + (60*1000*5)
"Mon Mar 07 2016 03:30:10 GMT+0000 (UTC)300000"
It seems like the + (60*1000*5) is just tacking 300000 at the end of the date string, instead of adding to the time. I don't have the same issue when I attempt subtraction.
I need the date arithmetic to be able to iterate spans of days, 5 minutes at a time.
bt_time.setMinutes(bt_time.getMinutes() + 5);