Skip to content

Instantly share code, notes, and snippets.

Created April 12, 2017 05:31
Show Gist options
  • Save anonymous/73e693da8de92c093f75634d251edf50 to your computer and use it in GitHub Desktop.
Save anonymous/73e693da8de92c093f75634d251edf50 to your computer and use it in GitHub Desktop.
6.2 LongDate created by smillaraaq - https://repl.it/HGEi/1
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