JavaScript: d.setUTCMinutes() Method e.g.

JavaScript: d.setUTCMinutes() Method e.g.

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

ParameterDescription
minThis is a first parameter and required. You can pass values integer value from 0-59 in this parameter
secThis is a second parameter and optional. You can pass values integer value from 0-59 in this parameter
millisecThis 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:

javascript date set utc minutes

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:

javascript date set utc minutes with seconds

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:

javascript date set utc minutes with seconds and milliseconds

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

  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: Date.getUTCDate() Method
  6. getUTCmonth Method javaScript With Example
  7. javaScript Digital Clock with date
  8. JavaScript: Set Date Methods
  9. String Contains JavaScript | String includes() Method
  10. JavaScript Get Date Methods
  11. JavaScript Operators With Examples
  12. Sorting Using JavaScript Array Sort() Method
  13. JavaScript Replace String With Examples
  14. JavaScript Array splice() Method By Example
  15. JavaScript: Clone an Array & Object By Example
  16. 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 *