Created
April 12, 2017 05:31
-
-
Save anonymous/73e693da8de92c093f75634d251edf50 to your computer and use it in GitHub Desktop.
6.2 LongDate created by smillaraaq - https://repl.it/HGEi/1
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
function longDate(myDate){ | |
var monthArray = ["", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; | |
var dateArray = myDate.split("/"); | |
var month = monthArray[dateArray[0]]; | |
var day = dateArray[1]; | |
var year = dateArray[2]; | |
if(year.length === 2){ | |
if(year <= "20"){ | |
year = "20" + year; | |
} else { | |
year = "19" + year; | |
} | |
} | |
var finalDate = month + " " + day + ", " + year; | |
console.log(finalDate); | |
} | |
longDate("7/12/99"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment