JavaScript setUTC Month ()


Advertisements


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

Syntax

The following syntax for setUTCMonth ( ) Method.

Date.setUTCMonth ( monthvalue )

Note − Parameters in the bracket are always optional.

Parameter Detail

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

Example

Try the following example.

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

Output

Fri Mar 28 2008 13:30:00 GMT+0530 (India Standard Time)

javascript_date_object.htm

Advertisements