C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
JavaScript Date getDay() methodThe JavaScript date getDay() method returns the value of day of the week for the specified date on the basis of local time. The value of the day starts with 0 that represents Sunday. SyntaxThe getDay() method is represented by the following syntax: dateObj.getDay() ReturnAn integer value between 0 and 6 that represents the days of the week for the specified date. JavaScript Date getDay() method exampleHere, we will understand getDay() method through various examples. Example 1Let's see an example to print the value of today's weekday. <script> var day=new Date(); document.writeln(day.getDay()); </script> Output: 1 Example 2Let's see an example to print the value of weekday from the given date. <script> var day=new Date("August 15, 1947 20:22:10"); document.writeln(day.getDay()) </script> Output: 5
Next TopicJavaScript Math
|