Created
March 3, 2021 17:52
-
-
Save n3r0bi0m4n/befb0b57be1617dded456c6b2b9d9d55 to your computer and use it in GitHub Desktop.
js timestamp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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