get day name from date javascript code example

Example 1: get name of day javascript

var today = new Date();

console.log(today.getDay()); // sunday = 0, monday = 1, etc..

Example 2: 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()];

Example 3: Get day first 3 letters name js

var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
var d = new Date(dateString);
var dayName = days[d.getDay()];