Q: How to set the 'time part' of an existing date variable to now In Javascript, I want to update only the time part (HH:MM:ss) of an existing Date type variable to "now" time part:
let's say d is an existing variable in the code...
var d = new Date('2015-10-12 20:00:00');
var now = new Date();
d.setHours(now.getHours(), now.getMinutes(), now.getSeconds());

Is there a better way to do it?

A: You can try it like this:
new Date(d.getTime() + (now - d)%(24*3600 * 1000))
This will create a new Date instance.
