This article will share how to check if date is Monday using JavaScript. We will do this using the toDateString()
and getDay()
methods. Let’s go.
How to check if date is Monday using JavaScript
We will use the following two solutions to check if a date is Monday:
- Using the
toDateString()
method - Using the
getDay()
method
Now, we will go to each solution with specific examples.
Using the toDateString() method
The toDateString()
method is used to return the date part (without the time part) as a string (in English) of a date object.
Syntax:
Date.toDateString()
Example:
// Create a date object const date = new Date("2023-01-10"); console.log(date.toDateString());
Output:
Tue Jan 10 2023
The value returned by the toDateString()
method has the following components:
- Abbreviation of the day of the week (e.g., Mon, Tue, etc.)
- Abbreviation of the month (e.g., Jan, Jun, etc.)
- A two-digit number representing the day of the month
- A number with at least four digits representing the year (e.g., 2023, 0999, etc.)
To check if the input date object is Monday using the toDateString()
method, we have to check if the output string of this method contains the ‘Mon’ substring using the String.includes()
method.
The String.includes()
method will return true if a substring exists in the specified string.
The following example describes checking if date is Monday using the toDateString()
method.
Example:
// Check if date is Monday function isMonday(date) { // Check if the output string of the toDateString() method contains the 'Mon' substring return date.toDateString().includes("Mon"); } // Create a date object const date = new Date("2023-01-09"); console.log(isMonday(date));
Output:
true
Using the getDay() method
In this solution, we use the getDay()
method to get the day of the week as an integer (0 to 6, Sunday is 0, Monday is 1, etc.) of the input date object.
The getDay()
method has the following syntax:
Date.getDay()
The following example describes checking if date is Monday using the getDay()
method.
Example:
// Check if date is Monday function isMonday(date) { // Check if the output of getDay() method is equal to 1 (Monday) return date.getDay() === 1; } // Create a date object const date = new Date("2023-01-09"); console.log(isMonday(date));
Output:
true
Click here to learn more about the JavaScript Date methods.
Summary
We have shared two solutions using the toDateString()
and getDate()
methods to check if date is Monday using JavaScrip. You can use any solution for your program. Thank you for reading.

Hello, my name’s Bruce Warren. You can call me Bruce. I’m interested in programming languages, so I am here to share my knowledge of programming languages with you, especially knowledge of C, C++, Java, JS, PHP.
Name of the university: KMA
Major: ATTT
Programming Languages: C, C++, Java, JS, PHP