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



JavaScript date setUTCSeconds() method sets the seconds for a specified date according to universal time.

The following are the parameters for setUTCSeconds(secondsValue[, msValue]) methodL

  • secondsValue − An integer between 0 and 59, representing the seconds.
  • msValue − A number between 0 and 999, representing the milliseconds.

Example

You can try to run the following code to set seconds for a specified date −

<html>
   <head>
      <title>JavaScript setUTCSeconds Method</title>
   </head>

   <body>
      <script>
         var dt = new Date( "Aug 28, 2008 13:30:00" );
         dt.setUTCSeconds( 65 );
         document.write( dt );
      </script>
   </body>
</html>

Advertisements