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