-
-
Save nocodesupplyco/96b972ee2f0f963f8dd2a7bc8b45a8ae to your computer and use it in GitHub Desktop.
Set Text to Today's Date
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
let today = new Date(); | |
let day = today.getDate(); | |
let month = today.getMonth() + 1; | |
let year = today.getFullYear(); | |
if (day < 10) { | |
day = '0' + day | |
} | |
if (month < 10) { | |
month = '0' + month | |
} | |
let out = document.getElementById("output"); | |
out.innerHTML = month + "/" + day + "/" + year; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment