The getUTCMinutes method in JavaScript retrieves the minutes component of a specific date according to Coordinated Universal Time (UTC).
Syntax
The syntax for the getUTCMinutes method is expressed as follows:
Example
dateObj.getUTCMinutes()
Return
A numerical value ranging from 0 to 59 that signifies the minute.
JavaScript Date getUTCMinutes method example
In this section, we will explore the getUTCMinutes method by examining multiple examples.
Example 1
Here’s an illustration to display the current minute in accordance with universal time.
Example
<script>
var min=new Date();
document.writeln("Minute value : "+min.getUTCMinutes());
</script>
Output:
Output
Minute value : 45
Example 2
Let’s examine an example that demonstrates how to extract and display the minute value from a specified date in accordance with Coordinated Universal Time (UTC).
Example
<script>
var min1=new Date("August 15 1975 22:59:30 GMT+7:00");
var min2=new Date("August 15 1975 22:59:30 GMT+5:30");
document.writeln("Minute value1 : "+min1.getUTCMinutes()+"<br>");
document.writeln("Minute value2 : "+min2.getUTCMinutes());
</script>
Output:
Output
Minute value1 : 59
Minute value2 : 29