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

WBOY
Release: 2023-09-13 09:57:03
forward
1192 people have browsed it

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>
Copy after login

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!

Related labels:
source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template