Answers for "get day name in javascript"

7

how to get the day name from date in javascript

var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
var d = new Date(dateString);
var dayName = days[d.getDay()];
Posted by: Guest on May-20-2021
9

get day js

switch (new Date().getDay()) {
  case 0:
    day = "Sunday";
    break;
  case 1:
    day = "Monday";
    break;
  case 2:
    day = "Tuesday";
    break;
  case 3:
    day = "Wednesday";
    break;
  case 4:
    day = "Thursday";
    break;
  case 5:
    day = "Friday";
    break;
  case 6:
    day = "Saturday";
}
Posted by: Guest on June-19-2020
2

get name of day javascript

var today = new Date();

console.log(today.getDay()); // sunday = 0, monday = 1, etc..
Posted by: Guest on August-22-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language