The getUTCMinutes() method returns the minutes ranged from 0 to 59 of the date object, according to universal time.
The getUTCMinutes() method returns the minutes ranged from 0 to 59 of the date object, according to universal time.
UTC time is the same as GMT time.
Date.getUTCMinutes()
None
A Number, from 0-59, representing the minutes
Return the minutes, according to universal time:
//display the minutes, according to UTC. var d = new Date(); var n = d.getUTCMinutes(); console.log(n);/*from w w w . j av a 2 s. c om*/ //Return the UTC minutes from a specific date and time: //display the minutes of a specific time, according to UTC. var d = new Date("July 21, 2010 01:15:00"); var n = d.getUTCMinutes(); console.log(n);
Using getUTCHours(), getUTCMinutes(), and getUTCSeconds() to display the universal time:
//display the UTC time. function addZero(i) { if (i < 10) { i = "0" + i; }//from w w w.j a v a2 s . c o m return i; } var d = new Date(); var h = addZero(d.getUTCHours()); var m = addZero(d.getUTCMinutes()); var s = addZero(d.getUTCSeconds()); console.log( h + ":" + m + ":" + s);