javascript set utc minutes with example. Here we will explain, how to sets utc minutes with seconds and milliseconds using the javaScript setUTCMinutes() method.
Some time, we work with date and time methods or function in javaScript. We need to set or get the utc time in hours, minutes, seconds and milliseconds. So this tutorial help you for sets the minutes in javascript with seconds and milliseconds.
JavaScript: setUTCMinutes() Method
Definition:- The setUTCMinutes() is an inbuild javascript method, which is used to sets the minute of a date object, according to the universal time (UTC).
Note: This method accepts three-parameter values. The first one is required and the remaining parameters are optional in this function.
Syntax
Date.setUTCMinutes(min, sec, millisec);
Parameter of setUTCMinutes() Method
Parameter | Description |
---|---|
min | This is a first parameter and required. You can pass values integer value from 0-59 in this parameter |
sec | This is a second parameter and optional. You can pass values integer value from 0-59 in this parameter |
millisec | This is a third parameter and optional. You can pass values integer value from 0-999 in this parameter |
If you want to pass the following
1. minutes in setUTCMinutes() method:
Date.setUTCMinutes(minute)
2. minutes and second in setUTCMinutes() method:
Date.setUTCMinutes(min, second)
3. minutes, seconds and millisecond in setUTCMinutes() method:
Date.setUTCMinutes(min, sec, millisec)
Example -1
Here we will take first example of setUTCMinutes method, without passing seconds and milliseconds:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>javascript date set utc minutes</title> </head> <body> <script type = "text/javascript"> var date = new Date(); date.setUTCMinutes(12); document.write( "javascript date set utc minutes using setUTCMinutes() : " + date ); </script> </body> </html>
Result of example – 1 is:
Example – 2
Here we will take second example of setUTCMinutes method, with minutes and seconds is:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>javascript date set utc minutes with seconds</title> </head> <body> <script type = "text/javascript"> var date = new Date(); date.setUTCMinutes(12, 16); document.write( "javascript date set utc minutes with seconds using setUTCMinutes() : " + date ); </script> </body> </html>
Result of example – 2 is:
Example – 3
Here we will take third example of setUTCMinutes method, with minutes and seconds and milliseconds is:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>javascript date set utc minutes with seconds and milliseconds</title> </head> <body> <script type = "text/javascript"> var date = new Date(); date.setUTCMinutes(12, 16, 50); document.write( "javascript date set utc minutes with seconds and milliseconds using setUTCMinutes() : " + date ); </script> </body> </html>
Result of example – 3 is:
Conclusion
In this javascript tutorial, you have learned how to sets a minute with seconds, milliseconds parameters using setUTCMinutes 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: 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.