Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

get number of days in a month javascript

function getDaysInMonth(year, month) {
  return new Date(year, month, 0).getDate();
}
Comment

get all days of month javascript

function getDayNamesInMonth(month, year) {
  let date = new Date(year, month, 1);
  let days = [];
  while (date.getMonth() === month) {
    days.push(new Date(date).toLocaleDateString('en-US', { weekday: 'short' }));
    date.setDate(date.getDate() + 1);
  }
  return dayNames;
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: Invert Keys 
Javascript :: Comparing traditional functions to arrow functions 
Javascript :: show each element of an array in a different line 
Javascript :: how to chnge line in browser js 
Javascript :: auto closing not working jsx 
Javascript :: how to print date in javascript without time 
Javascript :: Contentful Migration - Transform Entires 
Javascript :: classe jquery 
Javascript :: how to show numbers in javascript using while loop 
Javascript :: javascript decode base64 
Javascript :: how to pass information to a type=hidden from a function in javascript 
Javascript :: videoTitle$ Angular 2 - communication between two sibling components 
Javascript :: usecase of async/await 
Javascript :: e.addEventListener("input", function(){ e.value?n.innerText="Nama: "+e.value:n.innerText=""; }); 
Javascript :: set value localstorage javascript 
Javascript :: send keypress from iframe to parent 
Javascript :: Jasonplaseholder 
Javascript :: get any item in set js 
Javascript :: script.js:15 Uncaught ReferenceError: d3 is not defined at script.js 
Javascript :: get ordinal number 
Javascript :: how to access the page style in JS 
Javascript :: How to select a search bar without a `name`? javascript 
Javascript :: javascript refresh function every 5 seconds 
Javascript :: zgadfgad 
Javascript :: Increment counter each time an element is clicked 
Javascript :: play 2 audio react 
Javascript :: tabindex 
Javascript :: The console Module 
Javascript :: go-gitea/gitea 
Javascript :: moment js get dd/mm/yyyy 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =