Created
June 21, 2010 06:59
-
-
Save coryschires/446511 to your computer and use it in GitHub Desktop.
todays date javascript
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
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