Computer >> Computer tutorials >  >> Programming >> Javascript

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


Javascript date setUTCMilliseconds() method sets the milliseconds for a specified date according to universal time.

The following is the parameter for setUTCMilliseconds(millisecondsValue) −

  • millisecondsValue − A number between 0 and 999, representing the milliseconds.

Example

You can try to run the following code to set the milliseconds for a specified date according to universal time −

<html>
   <head>
      <title>JavaScript setUTCMilliseconds Method</title>
   </head>
   <body>
      <script>
         var dt = new Date( "Aug 28, 2008 23:30:00" );
         dt.setUTCMilliseconds( 1200 );
         
         document.write( dt );
      </script>
   </body>
</html>