Skip to content

Instantly share code, notes, and snippets.

@coryschires
Created June 21, 2010 06:59
Show Gist options
  • Save coryschires/446511 to your computer and use it in GitHub Desktop.
Save coryschires/446511 to your computer and use it in GitHub Desktop.
todays date javascript
var todays_date = function() {
var month_in_words = function(month_num) {
if (month_num === 0) { return "January" };
if (month_num === 1) { return "February" };
if (month_num === 2) { return "March" };
if (month_num === 3) { return "April" };
if (month_num === 4) { return "May" };
if (month_num === 5) { return "June" };
if (month_num === 6) { return "July" };
if (month_num === 7) { return "August" };
if (month_num === 8) { return "September" };
if (month_num === 9) { return "October" };
if (month_num === 10) { return "November" };
if (month_num === 11) { return "December" };
};
var date = new Date(),
day = date.getDate(),
month = month_in_words( date.getMonth() ),
year = date.getFullYear();
return month +" "+ day +", "+ year;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment