Set the month for a specified date according to universal time.


JavaScript date setUTCMonth ( ) method sets the month for a specified date according to universal time.

The following is the parameter of setUTCMonth ( monthvalue ) method in JavaScript −

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

Example

You can try to run the following code to set the month for a specified date according to 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>

Updated on: 23-Jun-2020

42 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements