Created
December 10, 2022 03:10
-
-
Save nhattruongniit/1a5577e6b02a8372c155dd7d23d7fb40 to your computer and use it in GitHub Desktop.
getDateTimeStringForFileName
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
| export default function () { | |
| const date = new Date(); | |
| const getDay = `0${date.getDate()}`.slice(-2).toString(); | |
| const getMonth = `0${date.getMonth() + 1}`.slice(-2).toString(); | |
| const getYear = date.getFullYear().toString(); | |
| const getHours = `0${date.getHours()}`.slice(-2).toString(); | |
| const getMinutes = `0${date.getMinutes()}`.slice(-2).toString(); | |
| const getSeconds = `0${date.getSeconds()}`.slice(-2).toString(); | |
| return `${getYear}-${getMonth}-${getDay} ${getHours}${getMinutes}${getSeconds}`; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment