Created
August 6, 2022 16:11
-
-
Save hieptl/7056eb01515d633dfb6bf583f696df46 to your computer and use it in GitHub Desktop.
How to Get the Current Date in Javascript - Format Date (YYYY-MM-DD)
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
const currentDate = new Date(); | |
const yyyyMMDDDate = | |
currentDate.getFullYear() + | |
"-" + | |
(currentDate.getMonth() + 1) + | |
"-" + | |
currentDate.getDate(); | |
console.log(yyyyMMDDDate); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment