Home  >  Article  >  Web Front-end  >  How to return the day of the week for a specified date based on UTC?

How to return the day of the week for a specified date based on UTC?

WBOY
WBOYforward
2023-09-13 09:57:031194browse

How to return the day of the week for a specified date based on UTC?

The getUTCDay() method of JavaScript’s date object returns the day of the week of the specified date based on coordinated universal time. getUTCDay()The value returned is an integer corresponding to the day of the week: 0 represents Sunday, 1 represents Monday, 2 represents Tuesday, and so on.

Example

You can try running the following code to return the day of the week for a 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>

The above is the detailed content of How to return the day of the week for a specified date based on UTC?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete