Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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()];
Comment

day name date js

new Date(dateString).toLocaleString('en-us', {weekday:'long'})
Comment

get day name from date javascript

const dayIndex = new Date().getDay();
const getDayName = (dayIndex) =>{
	const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
	return days[dayIndex];
}
const dayName = getDayName(dayIndex)
Comment

get name of day javascript

var today = new Date();

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

js get day name from date

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.
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript date is an object 
Javascript :: jquery add multiple classes 
Javascript :: nodejs aws s3 bucket delete item 
Javascript :: dynamic select option dropdown in jquery 
Javascript :: sort object by key value js 
Javascript :: react type div onClick 
Javascript :: eslint-disable-next-line 
Javascript :: format money javascript 
Javascript :: fetch api javascript 
Javascript :: javascript assignment operators 
Javascript :: npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! functions@ lint: `tslint --project tsconfig.json` 
Javascript :: comments in json 
Javascript :: viewchild for ngfor 
Javascript :: how to use typeof in javascript 
Javascript :: sotre json on chrome storage 
Javascript :: substring javscript 
Javascript :: use ngfor to make a dropdown in angular from array 
Javascript :: convert cookies to json javascript 
Javascript :: discord js check if person banned 
Javascript :: automatically scroll to bottom of page javascript 
Javascript :: unshift 
Javascript :: lwc quick action close 
Javascript :: format a date moment 
Javascript :: how to access key of object in javascript 
Javascript :: jquery edit iframe content 
Javascript :: angularjs accordion access toggle 
Javascript :: image upload in react js 
Javascript :: window bind load jquery 
Javascript :: session undefined nextauth 
Javascript :: jqueryreplace content of div 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =