Created
December 3, 2013 22:10
-
-
Save LeaVerou/7778454 to your computer and use it in GitHub Desktop.
Getting the month names from the browser
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
/** | |
* Getting the month names from the browser | |
*/ |
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
// Getting the month name from the browser | |
// Do not use. Looks like toDateString() is a bit more varied. | |
var str = (new Date()).toDateString(); | |
var month = str.slice(4,7); | |
// ...or var month = (str.match(/\w{3} (\w{3})/) || [,'?'])[1]; | |
document.body.innerHTML = month; |
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
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"javascript"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment