JavaScript Date getUTCMinutes()

Posted by

Method

JavaScript Date getUTCMinutes() Method

The JavaScript Date getUTCMinutes() method is used to get the minutes in a specified date according to universal time. The getUTCMinutes() method returns the minutes (from 0 to 59) in the specified date according to universal time.

Syntax

[dm_code_snippet background=”yes” background-mobile=”yes” slim=”no” line-numbers=”no” bg-color=”#abb8c3″ theme=”dark” language=”php” wrapped=”no” height=”” copy-text=”Copy Code” copy-confirmed=”Copied”]

dateObj.getUTCMinutes()

[/dm_code_snippet]

Parameter Values

This method does not accept any parameters.

Return Value

Returns the minutes (from 0 to 59) in the specified date according to universal time.

Browser Support

The getUTCMinutes() method is supported in all major browsers including Internet Explorer, Firefox, Chrome, Safari, and Opera.

Example

The following example shows the usage of the getUTCMinutes() method.

[dm_code_snippet background=”yes” background-mobile=”yes” slim=”no” line-numbers=”no” bg-color=”#abb8c3″ theme=”dark” language=”php” wrapped=”no” height=”” copy-text=”Copy Code” copy-confirmed=”Copied”]

// Create a new date object
var d = new Date();

// Display the minutes in the specified date according to universal time 
document.write(d.getUTCMinutes());

[/dm_code_snippet]

This will produce the following result:

[dm_code_snippet background=”yes” background-mobile=”yes” slim=”no” line-numbers=”no” bg-color=”#abb8c3″ theme=”dark” language=”php” wrapped=”no” height=”” copy-text=”Copy Code” copy-confirmed=”Copied”]

30

[/dm_code_snippet]

More Examples

The following example shows the usage of the getUTCMinutes() method in different date formats.

[dm_code_snippet background=”yes” background-mobile=”yes” slim=”no” line-numbers=”no” bg-color=”#abb8c3″ theme=”dark” language=”php” wrapped=”no” height=”” copy-text=”Copy Code” copy-confirmed=”Copied”]

// Create a new date object
var d1 = new Date("December 25, 2017 10:15:20");
document.write(d1.getUTCMinutes() + "<br>"); 

var d2 = new Date("July 15, 2019 03:05:45");
document.write(d2.getUTCMinutes() + "<br>"); 

var d3 = new Date("April 02, 2020 13:25:11");
document.write(d3.getUTCMinutes());

[/dm_code_snippet]

This will produce the following result:

[dm_code_snippet background=”yes” background-mobile=”yes” slim=”no” line-numbers=”no” bg-color=”#abb8c3″ theme=”dark” language=”php” wrapped=”no” height=”” copy-text=”Copy Code” copy-confirmed=”Copied”]

15 
5 
25

[/dm_code_snippet]

Conclusion

The JavaScript Date getUTCMinutes() method is used to get the minutes in a specified date according to universal time. The getUTCMinutes() method returns the minutes (from 0 to 59) in the specified date according to universal time.