javaScript Date set UTC milliseconds

javaScript Date set UTC milliseconds

javascript date set UTC milliseconds. Here we will explain, how to date sets UTC milliseconds using the javaScript setUTCMilliseconds() method.

JavaScript: setUTCMilliseconds() Method

Definition:- 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

Date.setUTCMilliseconds(millisec);

Parameter of 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

If you want to pass the following

1. seconds in setUTCSeconds() method:

 Date.setUTCMilliseconds(milliseconds)

Example

Here we will take first example of setUTCMilliseconds method, with passing milliseconds in method:

<!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>

Result of example 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.

You may like

  1. JavaScript: Date setUTCDate() Method
  2. Set UTC Month In javaScript
  3. setUTCFullYear() Method JavaScript With Examples
  4. javascript date setUTCHours() Method With Examples
  5. JavaScript: d.setUTCMinutes() Method e.g.
  6. setUTCSecond() Method By JavaScript
  7. JavaScript: Date.getUTCDate() Method
  8. getUTCmonth Method javaScript With Example
  9. javaScript Digital Clock with date
  10. JavaScript: Set Date Methods
  11. String Contains JavaScript | String includes() Method
  12. JavaScript Get Date Methods
  13. JavaScript Operators With Examples
  14. Sorting Using JavaScript Array Sort() Method
  15. JavaScript Replace String With Examples
  16. JavaScript Array splice() Method By Example
  17. JavaScript: Clone an Array & Object By Example
  18. Check the Object is Array or not in javascript

If you have any questions or thoughts to share, use the comment form below to reach us.

Leave a Reply

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