from Date I just want to subtract 1 day in javascript/angularjs
问题 with the help of new Date() how i can achieve this. my code : var temp =new Date("October 13, 2014 22:34:17"); console.log(new Date(temp-1)); requirement: before: Aug 4, 2014 11:59pm (EDT) after: Aug 3, 2014 11:59pm (EDT) 回答1: You need to specify what amount of time you are subtracting. At the moment its 1, but 1 what? Therefore, try getting the days using getDate() and then subtract from that and then set the date with setDate() . E.g. var temp = new Date("October 13, 2014 22:34:17"); temp