Home > Web Front-end > HTML Tutorial > Sets the month of the specified date according to UTC

Sets the month of the specified date according to UTC

WBOY
Release: 2023-08-27 11:13:06
forward
1422 people have browsed it

Sets the month of the specified date according to UTC

JavaScript date setUTCMonth ( ) method sets the month of the specified date based on universal time.

The following are the parameters of the setUTCMonth (MonthValue) method in JavaScript -

  • monthValue - An integer between 0 and 11, representing the month.

Example

You can try running the following code to set the month of a specified date based on universal time -

<html>
   <head>
      <title>JavaScript getUTCSeconds Method</title>
   </head>
   <body>
      <script>
         var dt = new Date( "Aug 28, 2008 13:30:00" );
         dt.setUTCMonth( 2 );
         
         document.write( dt );
      </script>
   </body>
</html>
Copy after login

The above is the detailed content of Sets the month of the specified date according to UTC. For more information, please follow other related articles on the PHP Chinese website!

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