Yes, you'll need arrays.

const days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
const months = ['January','February','March','April','May','June','July','August','September','October','November','December'];

var day = days[ now.getDay() ];
var month = months[ now.getMonth() ];

Or you can use the date.js library.


EDIT:

If you're going to use these frequently, you may want to extend Date.prototype for accessibility.

(function() {
    var days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
    
    var months = ['January','February','March','April','May','June','July','August','September','October','November','December'];

    Date.prototype.getMonthName = function() {
        return months[ this.getMonth() ];
    };
    Date.prototype.getDayName = function() {
        return days[ this.getDay() ];
    };
})();

var now = new Date();

var day = now.getDayName();
var month = now.getMonthName();
Answer from user113716 on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › getDay
Date.prototype.getDay() - JavaScript | MDN
const birthday = new Date("August ... console.log(day1); // Expected output: 2 ... An integer, between 0 and 6, representing the day of the week for the given date according to local time: 0 for Sunday, 1 for Monday, 2 for Tuesday, and so on....
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date
Date - JavaScript | MDN
Returns the day of the month (1 – 31) for the specified date according to local time. ... Returns the day of the week (0 – 6) for the specified date according to local time.
🌐
W3Schools
w3schools.com › jsref › jsref_getday.asp
JavaScript Date getDay() Method
Get the name of the weekday (not just a number): const weekday = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]; const d = new Date(); let day = weekday[d.getDay()]; Try it Yourself » · JavaScript Dates · JavaScript Date Formats ·
🌐
Day.js
day.js.org › docs › en › display › format
Format · Day.js
Get the formatted date according to the string of tokens passed in. To escape characters, wrap them in square brackets (e.g. [MM]). dayjs().format() // current date in ISO8601, without fraction seconds e.g.
🌐
freeCodeCamp
freecodecamp.org › news › how-to-format-dates-in-javascript
How to Format Dates in JavaScript with One Line of Code
November 7, 2024 - And I thought that this was the best way until I recently figured out that we don’t always need to use libraries to format dates in JavaScript**.** In case you are curious to try this out, here is the code:👇 · new Date().toLocaleDateString('en-us', { weekday:"long", year:"numeric", month:"short", day:"numeric"}) // "Friday, Jul 2, 2021" After trying this in your own code and seeing that it works, let's understand why it works and learn some other ways of formatting dates in JavaScript with just one line of code.
🌐
JavaScript.info
javascript.info › tutorial › the javascript language › data types › date and time
Show a weekday
Write a function getWeekDay(date) to show the weekday in short format: ‘MO’, ‘TU’, ‘WE’, ‘TH’, ‘FR’, ‘SA’, ‘SU’. ... The method date.getDay() returns the number of the weekday, starting from sunday. Let’s make an array of weekdays, so that we can get the proper day ...
🌐
Bugfender
bugfender.com › blog › javascript-date-and-time
The Definitive Guide to JavaScript Date and Time | Bugfender
February 18, 2025 - Check out the code snippet below. We have passed the option to obtain the date in a format where a day is a numeric number, and the month name should be a long-formatted numeric year, and a long-formatted weekday.
Find elsewhere
🌐
freeCodeCamp
freecodecamp.org › news › javascript-date-format-how-to-format-a-date-in-js
JavaScript Date Format – How to Format a Date in JS
November 7, 2024 - In others, the day comes before the month, then the year (22/06/2022), and lots more. Regardless of the format, you want to break down the date object value and get the necessary information you want for your web page. This is possible with the JavaScript date methods.
🌐
Altcademy
altcademy.com › blog › how-to-format-date-in-javascript
How to format date in JavaScript
June 9, 2023 - In this example, we specify a custom format that includes the day of the week, the full month name, and the full year. The output will be different for other locales. In this blog post, we've learned how to format dates and times in JavaScript using the built-in Date object and its methods.
🌐
Decodingweb
decodingweb.dev › javascript-day-of-week
Get the day of the week in JavaScript without a library
September 22, 2023 - const today = new Date() console.log(today.getDayAsString()) console.log(today.getDayAsString('de-DE', { weekday: 'long' })) Alright, I think that does it! I hope you found this guide helpful. Thanks for reading. Reza Lavarian Hey 👋 I'm a software engineer, an author, and an open-source contributor. I enjoy helping people (including myself) decode the complex side of technology. I share my findings on Twitter: @rezalavarian · Convert a dd/mm/yyyy string to a Date object in JavaScript · Subtract days from a date in JavaScript without a library
🌐
Scaler
scaler.com › home › topics › format date in javascript
Format Date in JavaScript - Scaler Topics
December 27, 2023 - In the above code, we have created a date object using new Date() and stored it in constant date. date.getDay() extracts the day of the week from the date object starting from Sunday as 0. In this example, the date falls on Sunday hence the ...
🌐
TutorialsPoint
tutorialspoint.com › javascript › date_getday.htm
JavaScript Date getDay() Method
This method returns the day of the week based on local time, not UTC time. If you need UTC-based day of the week, use getUTCDay() method. Following is the syntax of JavaScript Date getDay() method −
Top answer
1 of 16
333

Use the methods provided by the standard JavaScript Date class:

Getting the day name from a 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.

Getting all weekdays in an array:

function getWeekDays(locale)
{
    var baseDate = new Date(Date.UTC(2017, 0, 2)); // just a Monday
    var weekDays = [];
    for(i = 0; i < 7; i++)
    {       
        weekDays.push(baseDate.toLocaleDateString(locale, { weekday: 'long' }));
        baseDate.setDate(baseDate.getDate() + 1);       
    }
    return weekDays;
}

var weekDays = getWeekDays('nl-NL'); // Gives back { 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag', 'zondag'} which are the days of the week in Dutch.

For American dates use 'en-US' as locale.

2 of 16
187

You could use the Date.getDay() method, which returns 0 for sunday, up to 6 for saturday. So, you could simply create an array with the name for the day names:

var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
var d = new Date(dateString);
var dayName = days[d.getDay()];

Here dateString is the string you received from the third party API.

Alternatively, if you want the first 3 letters of the day name, you could use the Date object's built-in toString method:

var d = new Date(dateString);
var dayName = d.toString().split(' ')[0];

That will take the first word in the d.toString() output, which will be the 3-letter day name.

🌐
CSS-Tricks
css-tricks.com › everything-you-need-to-know-about-date-in-javascript
Everything You Need to Know About Date in JavaScript | CSS-Tricks
September 22, 2022 - Let’s say you want something like Thu, 23 January 2019. To create this value, you need to know (and use) the date methods that comes with the Date object. ... getDay: Gets day of the week (0-6) according to local time.
🌐
Bobby Hadz
bobbyhadz.com › blog › javascript-get-day-of-week
How to get the Day of the Week in JavaScript | bobbyhadz
The getDay method returns the day of the week for the specified date, represented as an integer between 0 and 6, where 0 is Sunday and 6 is Saturday.
🌐
Jsguru
jsguru.org › javascript › how-to-get-day-of-week
How to Get Day of Week in JavaScript? - JsGuru
Learn Javascript, Typescript, Angular, Firebase, Git and many more web developement techs by - Pankaj Prakash
🌐
Techfunda
techfunda.com › howto › 823 › get-day-name-of-date
Get day name of date in JavaScript - Tech Funda
As we all know there are 7 days in a week, the numbering for those days in JavaScript goes as follow, Sunday=0, Monday=1, Tuesday=2,................Saturday=6. This method does not have any parameters. In JavaScript, by using getDay() we can return the name of the present day.