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

HTMLJavascriptProgramming Scripts

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>
raja
Published on 26-Feb-2018 07:35:08
Advertisements