Date getUTCMinutes() method with example in JavaScript

JavaScript Date getUTCMinutes() method: Here, we are going to learn about the getUTCMinutes() method of Date class with Example in JavaScript.
Submitted by IncludeHelp, on March 08, 2019

JavaScript Date getUTCMinutes() method

getUTCMinutes() method is a Date's class method and it is used to get minutes from the current time according to the UTC (Universal time coordinated).

Syntax:

    var dt = new Date();
    dt.getUTCMinutes();

Examples:

    Input:
    var dt = new Date();
    dt.getUTCMinutes();
    
    Output:
    19

JavaScript code to get the current UTC minutes using getUTCMinutes() method

<html>
<head><title>JavaScipt Example</title></head>

<body>
<script>
	var dt = new Date(); //Date constructor 
	var mins1 = dt.getUTCMinutes(); //UTC minutes 
	var mins2 = dt.getMinutes(); //local minutes
	//printing minutes
	document.write("UTC minutes = " + mins1 + "<br>");
	document.write("Local minutes = " + mins2 + "<br>");
</script>
</body>
</html>

Output

UTC minutes = 49
Local minutes = 19

Reference: JavaScript getUTCMinutes() Method

JavaScript Date Object Methods »




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.