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 :: get value of checked radio button jquery 
Javascript :: how to truncate string in javascript 
Javascript :: Get parent directory name in Node.js 
Javascript :: jquery toggle checkbox 
Javascript :: html form pattern message 
Javascript :: jquery validation plugin 
Javascript :: check if url contains string 
Javascript :: python get json content from file 
Javascript :: js order alphabetically 
Javascript :: vue js store and retrieve api data to localstorage 
Javascript :: set datetimepicker javascript 
Javascript :: nodejs create buffer from string 
Javascript :: adonis count with where 
Javascript :: react confirm alert 
Javascript :: redirect to another page javascript 
Javascript :: redirect the page in javascript 
Javascript :: javascript array distinct 
Javascript :: iso date javascript 
Javascript :: javascript date get minutes with leading zero 
Javascript :: li key attribute 
Javascript :: Javascript prime number check 
Javascript :: too many open files react native 
Javascript :: js sound 
Javascript :: javascript check if set 
Javascript :: javascript thousand separator 
Javascript :: json data doesn show on console 
Javascript :: check box all in jequery data table 
Javascript :: reset navigation to specific tab react-navigation 
Javascript :: jQuery UI Sortable, then write order into a database 
Javascript :: javascript confirm delete 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =