Skip to content

Instantly share code, notes, and snippets.

@upupming
Created April 7, 2022 08:53
Show Gist options
  • Save upupming/773c0a72a0d50338366d2161410a1986 to your computer and use it in GitHub Desktop.
Save upupming/773c0a72a0d50338366d2161410a1986 to your computer and use it in GitHub Desktop.
const date = new Date()
const YYYY = date.getFullYear()
const MM = String(date.getMonth() + 1).padStart(2, '0')
const dd = String(date.getDate() + 1).padStart(2, '0')
const hh = String(date.getHours() + 1).padStart(2, '0')
const mm = String(date.getMinutes() + 1).padStart(2, '0')
const ss = String(date.getSeconds() + 1).padStart(2, '0')
const timestamp = [YYYY, MM, dd, hh, mm, ss].join('-')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment