Latest web development tutorials

JavaScript setUTCMinutes () method

Date Object Reference JavaScript Date Object

Examples

UTC time is set according to the number of minutes in paragraph 17:

var d = new Date();
d.setUTCMinutes(17);

d output in local time:


try it"

Definition and Usage

setUTCMinutes () method is used to set the minute specified time according to Universal Time (UTC).

Tip: Coordinated Universal Time, also known as the unified world time, Universal Time, Coordinated Universal Time, abbreviated UTC (Universal Coordinated Time).

Note: UTC time is the GMT (Greenwich Mean) time.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support setUTCMinutes () method


grammar

Date.setUTCMinutes( min , sec , millisec )

Parameter Values

参数 描述
min 必需。要给 date Object 设置的分钟字段的值,用世界时表示。

该参数应该是 0 ~ 59 之间的整数:

  • -1 为上一分钟的最后一秒
  • 60 为下一分钟的第一秒
sec 可选。要给 dateObject 设置的秒字段的值。使用世界时表示。

该参数是 0 ~ 59 之间的整数:

  • -1 为上一分钟的最后一秒
  • 60 为下一分钟的第一秒
millisec 可选。要给 date Object 设置的毫秒字段的值。使用世界时表示。

该参数是 0 ~ 999 之间的整数:

  • -1 为上一秒钟的最后1毫秒
  • 1000 为下一秒中的第一毫秒

return value

类型 描述
Number 1970 年 1月 午夜至设置时间的毫秒数。

technical details

JavaScript version: 1.3


More examples

Examples

In this example, we will () method to set the current time minute field by setUTCMinutes 90 minutes ago:

var d = new Date();
d.setUTCMinutes(d.getUTCMinutes()-90);

d output according to the current time:


try it"


Date Object Reference JavaScript Date Object