Last active
October 30, 2015 12:27
-
-
Save jasdeepkhalsa/8d67f69053c470812360 to your computer and use it in GitHub Desktop.
Format's JavaScript's Date's Day (returned as an integer)
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
function formatDay(day) { | |
switch (day) { | |
case 1: | |
case '1': | |
return 'Mon'; | |
case 2: | |
case '2': | |
return 'Tue'; | |
case 3: | |
case '3': | |
return 'Wed'; | |
case 4: | |
case '4': | |
return 'Thu'; | |
case 5: | |
case '5': | |
return 'Fri'; | |
case 6: | |
case '6': | |
return 'Sat'; | |
case 0: | |
case '0': | |
return 'Sun'; | |
default: | |
return ''; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment