Categories
JavaScript Answers

How to fix JavaScript Date.getDay() returns wrong day?

Spread the love

Sometimes, we want to fix JavaScript Date.getDay() returns wrong day.

In this article, we’ll look at how to fix JavaScript Date.getDay() returns wrong day.

How to fix JavaScript Date.getDay() returns wrong day?

To fix JavaScript Date.getDay() returns wrong day, we use the date’s getDate method to get the day of the month.

For instance, we write

const date = new Date().getDate();

to get the date of the month of today’s date with getDate.

Conclusion

To fix JavaScript Date.getDay() returns wrong day, we use the date’s getDate method to get the day of the month.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *