-
-
Save robotlolita/665802 to your computer and use it in GitHub Desktop.
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
var sDate = new Date() | |
, today = new Date() | |
, str = "" | |
, node; | |
sDate.setFullYear(2011, 0, 1); | |
if (sDate > today) { | |
str = sDate.getFullYear() } | |
else { | |
str = '2010-' + sDate.getFullYear() } | |
// adds the date to the document | |
node = document.createTextNode(str); // creates a text element that holds the data to write to the document | |
document.body.appendChild(node); // appends the node to the document (making it visible) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment