Last active
March 24, 2020 16:32
-
-
Save xeniode/0ba585dc9c8ea04c3e65a5ee97091f2e to your computer and use it in GitHub Desktop.
[JS-Current Date Time Func] #javascript #datetime
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 function getCurrentDate(separator=''){ | |
let newDate = new Date() | |
let date = newDate.getDate(); | |
let month = newDate.getMonth() + 1; | |
let year = newDate.getFullYear(); | |
return `${year}${separator}${month<10?`0${month}`:`${month}`}${separator}${date}` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment