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 :: remove header border react native 
Javascript :: react native textInput numbers only 
Javascript :: ondomcontentloaded javascript 
Javascript :: How disable button jquery 
Javascript :: javascript scroll to top of page 
Javascript :: javascript remove all spaces from string 
Javascript :: request to https://registry.npmjs.org/webpack failed, reason: unable to get local issuer certificate 
Javascript :: regex date validation mm/dd/yyyy 
Javascript :: macos chrome disable web security 
Javascript :: jquery check how many child elements 
Javascript :: jquery phone number mask 
Javascript :: js loop through array backwards 
Javascript :: javascript generate random color 
Javascript :: jQuery and changing the input field type 
Javascript :: js loop every second 
Javascript :: react onclick type 
Javascript :: js console log with color 
Javascript :: bootstrap modal title center 
Javascript :: javascript int to float 
Javascript :: convert hexadecimal to decimal js 
Javascript :: jquery get the length of input text 
Javascript :: remove yellow warning react native emulator 
Javascript :: emmet not working react js 
Javascript :: javascript detect internet explorer 
Javascript :: jquery scroll to top 
Javascript :: jquery check if div has a certain style 
Javascript :: react native clear cach 
Javascript :: scroll to element javascript 
Javascript :: object to url params js 
Javascript :: bootstrap show modal on page load 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =