var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
var d = new Date(dateString);
var dayName = days[d.getDay()];
new Date(dateString).toLocaleString('en-us', {weekday:'long'})
const dayIndex = new Date().getDay();
const getDayName = (dayIndex) =>{
const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
return days[dayIndex];
}
const dayName = getDayName(dayIndex)
var today = new Date();
console.log(today.getDay()); // sunday = 0, monday = 1, etc..
function getDayName(dateStr, locale)
{
var date = new Date(dateStr);
return date.toLocaleDateString(locale, { weekday: 'long' });
}
var dateStr = '05/23/2014';
var day = getDayName(dateStr, "nl-NL"); // Gives back 'Vrijdag' which is Dutch for Friday.