How can I add a static timestamp?

I want to add a static timestamp (for a list or social media app for example) using plain javascript. Currently I have it like this:

  const d = new Date();
  const time = d.toLocaleTimeString();

The problem is that when you refresh, it also refreshes the time and sets it to your current time, not the time that the item was posted. How can I fix this?