Created
August 19, 2013 17:25
-
-
Save adeubank/6271703 to your computer and use it in GitHub Desktop.
Add a method to print the United States date format to the global Date object for JavaScript.
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
// Add toUSDateString to global Date object, prints Mon/Day/Year | |
Date.prototype.toUSDateString = function () { | |
return (this.getMonth() + 1) + "/" + this.getDate() + "/" + this.getFullYear(); | |
}; | |
(new Date()).toUSDateString(); // "MM/DD/YYYY" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment