Created
April 4, 2021 21:38
-
-
Save neodigm/fce84b82058270dadd4e5de59d5eedaf to your computer and use it in GitHub Desktop.
This file contains 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
getReadableTS(){. //. Human readable timestamp for automatic file naming | |
const date = new Date(); | |
const year = date.getFullYear(); | |
const month = `${date.getMonth() + 1}`.padStart(2, '0'); | |
const day =`${date.getDate()}`.padStart(2, '0'); | |
const hour = date.getHours(); | |
const minutes = date.getMinutes(); | |
const seconds = date.getSeconds(); | |
return `${year}${month}${day}_${hour}${minutes}${seconds}` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment