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
| Parameter | Description |
|---|---|
| millisec | It 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
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
- JavaScript: Date setUTCDate() Method
- Set UTC Month In javaScript
- setUTCFullYear() Method JavaScript With Examples
- javascript date setUTCHours() Method With Examples
- JavaScript: d.setUTCMinutes() Method e.g.
- setUTCSecond() Method By JavaScript
- JavaScript: Date.getUTCDate() Method
- getUTCmonth Method javaScript With Example
- javaScript Digital Clock with date
- JavaScript: Set Date Methods
- String Contains JavaScript | String includes() Method
- JavaScript Get Date Methods
- JavaScript Operators With Examples
- Sorting Using JavaScript Array Sort() Method
- JavaScript Replace String With Examples
- JavaScript Array splice() Method By Example
- JavaScript: Clone an Array & Object By Example
- 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.