Skip to content

Instantly share code, notes, and snippets.

@n3r0bi0m4n
Created March 3, 2021 17:52
Show Gist options
  • Select an option

  • Save n3r0bi0m4n/befb0b57be1617dded456c6b2b9d9d55 to your computer and use it in GitHub Desktop.

Select an option

Save n3r0bi0m4n/befb0b57be1617dded456c6b2b9d9d55 to your computer and use it in GitHub Desktop.
js timestamp
function timestamp() {
const pad = (t) => String(t).padStart(2, '0');
const nowRaw = new Date();
return `${pad(nowRaw.getUTCHours())}:${pad(nowRaw.getUTCMinutes())}:${pad(nowRaw.getUTCSeconds())}.${String(nowRaw.getUTCMilliseconds()).padStart(3, '0')}`;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment