Skip to content

Instantly share code, notes, and snippets.

@jasdeepkhalsa
Last active October 30, 2015 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasdeepkhalsa/8d67f69053c470812360 to your computer and use it in GitHub Desktop.
Save jasdeepkhalsa/8d67f69053c470812360 to your computer and use it in GitHub Desktop.
Format's JavaScript's Date's Day (returned as an integer)
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