JavaScript getUTCMilliseconds() | Get the UTC Milliseconds

The JavaScript getUTCMilliseconds() method is used to get the milliseconds (0-999) according to Universal Time Coordinated (UTC) or Greenwich Mean Time (GMT). For example:

HTML with JavaScript Code
<!DOCTYPE html>
<html>
<body>
   
   <p id="xyz"></p>

   <script>
      const d = new Date();
      let ms = d.getUTCMilliseconds();
      document.getElementById("xyz").innerHTML = ms;
   </script>

</body>
</html>
Output

JavaScript getUTCMilliseconds() Syntax

The syntax of getUTCMilliseconds() method in JavaScript is:

x.getUTCMilliseconds()

where x must be an object of the Date() constructor.

Please note: The getUTCMilliseconds() method returns a number from 0 to 999 which will be the milliseconds of the UTC time.

JavaScript Online Test


« Previous Tutorial Next Tutorial »