JavaScript Date.setUTCmilliseconds Method

JavaScript date set UTC milliseconds; Through this tutorial, i am going to show you how to date sets UTC milliseconds using the javaScript setUTCMilliseconds() method with the help of examples.

JavaScript setUTCMilliseconds() Method

The setUTCMilliseconds() is an inbuild javascript method, which is used to sets the millisecond of a date object, according to the universal time (UTC).

Note: This method accepts one parameter and values between 0 to 999.

Syntax of JavaScript setUTCMilliseconds() Method

Date.setUTCMilliseconds(millisec);

Parameter of JavaScript setUTCMilliseconds() Method

ParameterDescription
millisecIt allows only one parameter and it will be required. You can pass values integer value from 0-999 in this parameter

Example of JavaScript setUTCMilliseconds() Method

Let’s see the following example of setUTCMilliseconds method; as shown below:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>javascript date set utc milliseconds</title>
</head>
<body>
  <script type = "text/javascript">
     var date = new Date();
     date.setUTCMilliseconds(100);
     document.write( "javascript date set utc milliseconds using setUTCMilliseconds() : " + date );
  </script>  
</body>
</html>

Output of the above code is:-

javascript date set utc milliseconds

Conclusion

In this javascript tutorial, you have learned how to date set UTC milliseconds with milliseconds parameters using setUTCMilliseconds method with an example.

Recommended JavaScript Tutorials

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *