JavaScript Date getUTCMinutes() Method

Definition and Usage

getUTCMinutes() The method returns the number of minutes (from 0 to 59) for a specified date and time based on universal time.

When calculating dates, the UTC methods assume the date object is the local time and date.

Tip:Coordinated Universal Time (UTC) is the standard time set for world time.

Note:Coordinated Universal Time (UTC) is the same as Greenwich Mean Time (GMT).

Example

Example 1

Return the number of minutes based on Coordinated Universal Time (UTC):

var d = new Date();
var n = d.getUTCMinutes();

Try It Yourself

Example 2

Return the UTC minutes for a specific date and time:

var d = new Date("July 21, 1983 01:15:00");
var n = d.getUTCMinutes();

Try It Yourself

Example 3

Display Coordinated Universal Time (UTC) using getUTCHours(), getUTCMinutes(), and getUTCSeconds():

function addZero(i) {
  if (i < 10) {
    i = "0" + i;
  }
  return i;
}
function myFunction() {
  var d = new Date();
  var x = document.getElementById("demo");
  var h = addZero(d.getUTCHours());
  var m = addZero(d.getUTCMinutes());
  var s = addZero(d.getUTCSeconds());
  x.innerHTML = h + ":" + m + ":" + s;
}

Try It Yourself

Syntax

Date.getUTCMinutes()

Parameters

No parameters.

Technical Details

Return Value: Numbers, from 0 to 59, represent minutes.
JavaScript Version: ECMAScript 1

Browser Support

Method Chrome IE Firefox Safari Opera
getUTCMinutes() Support Support Support Support Support

Related Pages

Tutorial:JavaScript Date

Tutorial:JavaScript Date Format

Tutorial:JavaScript Object Constructor