I would use the unix timestamp to get the time (another timestamp) 12 hours ago. I would then put code similar to what you have there into a function (with a timestamp argument) which creates a displayTime variable from that argument, then use setInterval with that function to display the times leading up to now
make sense?