Created
April 12, 2022 01:03
-
-
Save AbeEstrada/887dd737f81b5aef4888358b5a1db767 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
const formatDate = (date) => { | |
const year = date.getFullYear(); | |
const month = String(date.getMonth() + 1).padStart(2, "0"); | |
const day = String(date.getDate()).padStart(2, "0"); | |
const hours = String(date.getHours()).padStart(2, "0"); | |
const minutes = String(date.getMinutes()).padStart(2, "0"); | |
const seconds = String(date.getSeconds()).padStart(2, "0"); | |
return `${[year, month, day].join("/")} ${[hours, minutes, seconds].join(":")}`; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment