How to return the day of the week in the specified date according to universal time?


JavaScript date getUTCDay() method returns the day of the week in the specified date according to universal time. The value returned by getUTCDay() is an integer corresponding to the day of the week: 0 for Sunday, 1 for Monday, 2 for Tuesday, and so on.

Example

You can try to run the following code to return the day of the week in the specified date −

<html>
   <head>
      <title>JavaScript getUTCDay Method</title>
   </head>

   <body>
      <script>
         var dt = new Date( "January 15, 2018 20:15:20" );
         document.write("getUTCDay() : " + dt.getUTCDay() );
      </script>
   </body>
</html>

Updated on: 23-Jun-2020

63 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements