Skip to content

Instantly share code, notes, and snippets.

@rifayetuxbd
Created June 22, 2022 03:38
Show Gist options
  • Select an option

  • Save rifayetuxbd/1b4613c2f5ff74574d02b08c343b3a53 to your computer and use it in GitHub Desktop.

Select an option

Save rifayetuxbd/1b4613c2f5ff74574d02b08c343b3a53 to your computer and use it in GitHub Desktop.

Get the current day name

function getCurrentDayName() {
  const currentDate = new Date();
  // 
  // Day must start with monday
  const days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
  const currentDay = days[currentDate.getDay() - 1];
  
  return currentDay;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment