2

I have the following code:

//console.log(response.data[key]) = 12:40
newDateObj = new Date(today + ' '+ response.data[key]);
console.log(newDateObj);
//Mon Apr 30 2001 12:40:00 GMT+0100 (GMT Daylight Time)
newDateObjAltered = (newDateObj.getTime() + (60 * 60 * 1000));  
console.log(newDateObjAltered);
//988634400000 

All I want to do is take the time stored in response.data[key] and add an hour to it and then return it in the same format. So for the example above I'd want 13:40 back. I'm getting the timestamp back...how can I format this correctly?

Mike Rifgin
  • 10,409
  • 21
  • 75
  • 111

1 Answers1

1
newDateObjAltered = new Date(newDateObj.getTime() + (60 * 60 * 1000));
ValarDohaeris
  • 6,064
  • 5
  • 31
  • 43