Created
February 2, 2017 09:36
-
-
Save dhunmoon/032d1d7d4e180e63dbf8465f0fdc35a5 to your computer and use it in GitHub Desktop.
JS: Get Day Name
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
//Get Day Name like SUN,MON instead of 0,1,2 | |
var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; | |
var d = new Date(<YOUR-DATE>);//Pass a Date here | |
var dayName = days[d.getDay()];//d.getDay() function returns the day name as 0,1,2,3 here 0 = Sunday |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment