In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "Javascript how to get the day of the week". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!
Methods: 1. Use "Date ('Year-Month-Day');" to get the date object of the specified time;2. Use "Date object.getDay();" to get the number that the specified time represents a certain day of the week;3. Use the obtained number as a subscript to extract the day of the week from the specified array.
Operating environment of this tutorial: Windows 10 system, Javascript version 1.8.5, Dell G3 computer.
Javascript How to get the day of the week
Date objects are used to handle dates and times.
Create Date object: new Date()
There are four ways to create Date objects:
var d = new Date();var d = new Date(milliseconds);var d = new Date(dateString);var d = new Date(year, month, day, hours, minutes, seconds, milliseconds);
The getDay() method returns the number of days of the week (0 - 6).
The syntax is:
Date.getDay()
The return value is an integer between 0 (Sunday) and 6 (Saturday).
Examples are as follows:
Click the button to display today of the week
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.