Skip to content

Instantly share code, notes, and snippets.

@LeaVerou
Created December 3, 2013 22:10
Show Gist options
  • Save LeaVerou/7778454 to your computer and use it in GitHub Desktop.
Save LeaVerou/7778454 to your computer and use it in GitHub Desktop.
Getting the month names from the browser
/**
* Getting the month names from the browser
*/
// 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;
{"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